Compare commits

...

11 Commits

Author SHA1 Message Date
df5d1aad48 chore(release): 1.6.5 2026-03-03 15:25:39 +08:00
a6588818b5 fix: error koneksi Prisma - DATABASE_URL tidak loaded di
production
- Tambah validasi DATABASE_URL di prisma.ts
- Tambah copy .env file di postbuild script

### No Issue
2026-03-03 14:15:15 +08:00
58e1afaa45 chore(release): 1.6.4 2026-03-03 14:14:00 +08:00
250b7c5261 Fix Prisma 2026-03-03 12:03:30 +08:00
935e519662 chore(release): 1.6.3 2026-03-03 11:55:25 +08:00
c6dbd152d5 Fix middleware
### NO Issue
2026-02-25 15:34:22 +08:00
714cf5cd5a chore(release): 1.6.2 2026-02-25 15:22:40 +08:00
a68343599d Fix type env
Fix:
- modified:   types/env.d.ts

### No Issue
2026-02-25 14:25:13 +08:00
419b87fc92 chore(release): 1.6.1 2026-02-25 12:00:20 +08:00
0271c87ba9 Delete termsOfServiceAccepted on register
### No issue
2026-02-24 18:04:05 +08:00
5551f30721 Fix API and clear code
modified:   src/app/api/auth/register/route.ts
 modified:   src/app_modules/auth/login/view.tsx

### No Issue
2026-02-24 07:38:44 +08:00
10 changed files with 150 additions and 28 deletions

View File

@@ -2,6 +2,21 @@
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
## [1.6.5](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.6.4...v1.6.5) (2026-03-03)
### Bug Fixes
* error koneksi Prisma - DATABASE_URL tidak loaded di ([a658881](https://wibugit.wibudev.com/wibu/hipmi/commit/a6588818b5d8018b3a634e0ae0846e309569d370))
## [1.6.4](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.6.3...v1.6.4) (2026-03-03)
## [1.6.3](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.6.2...v1.6.3) (2026-03-03)
## [1.6.2](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.6.1...v1.6.2) (2026-02-25)
## [1.6.1](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.6.0...v1.6.1) (2026-02-25)
## [1.6.0](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.40...v1.6.0) (2026-02-23)

View File

@@ -3,12 +3,20 @@ const nextConfig = {
reactStrictMode: false,
experimental: {
serverActions: true,
serverComponentsExternalPackages: ['@prisma/client'],
},
output: "standalone",
staticPageGenerationTimeout: 180, // tingkatkan menjadi 3 menit
eslint: {
ignoreDuringBuilds: true,
},
webpack: (config, { isServer }) => {
if (isServer) {
config.externals = config.externals || [];
config.externals.push('@prisma/client');
}
return config;
},
// async headers() {
// return [
// {

View File

@@ -1,15 +1,16 @@
{
"name": "hipmi",
"version": "1.6.0",
"version": "1.6.5",
"private": true,
"prisma": {
"seed": "bun prisma/seed.ts"
},
"scripts": {
"dev": "next dev --experimental-https",
"build": "next build",
"build:dev": "next build",
"build": "prisma generate && next build",
"build:dev": "prisma generate && next build",
"start": "next start",
"postbuild": "node scripts/postbuild.js",
"lint": "next lint",
"ver": "bunx commit-and-tag-version -- --prerelease"
},

64
scripts/postbuild.js Normal file
View File

@@ -0,0 +1,64 @@
const fs = require('fs');
const path = require('path');
const standaloneDir = path.join(__dirname, '../.next/standalone');
const prismaDir = path.join(__dirname, '../node_modules/.prisma');
console.log('🚀 Running postbuild script...');
// Copy Prisma binaries ke standalone output
if (fs.existsSync(prismaDir)) {
const dest = path.join(standaloneDir, 'node_modules/.prisma');
fs.mkdirSync(path.dirname(dest), { recursive: true });
fs.cpSync(prismaDir, dest, { recursive: true });
console.log('✓ Prisma binaries copied to standalone output');
} else {
console.warn('⚠ Prisma binaries directory not found, skipping...');
}
// Copy schema.prisma jika diperlukan
const schemaSrc = path.join(__dirname, '../prisma/schema.prisma');
const schemaDest = path.join(standaloneDir, 'prisma/schema.prisma');
if (fs.existsSync(schemaSrc)) {
fs.mkdirSync(path.dirname(schemaDest), { recursive: true });
fs.copyFileSync(schemaSrc, schemaDest);
console.log('✓ schema.prisma copied to standalone output');
} else {
console.warn('⚠ schema.prisma not found, skipping...');
}
// Copy prisma client dari node_modules/@prisma/client
const prismaClientSrc = path.join(__dirname, '../node_modules/@prisma/client');
const prismaClientDest = path.join(standaloneDir, 'node_modules/@prisma/client');
if (fs.existsSync(prismaClientSrc)) {
fs.mkdirSync(path.dirname(prismaClientDest), { recursive: true });
fs.cpSync(prismaClientSrc, prismaClientDest, { recursive: true });
console.log('✓ @prisma/client copied to standalone output');
} else {
console.warn('⚠ @prisma/client not found, skipping...');
}
// Copy .env file jika ada (untuk production)
const envSrc = path.join(__dirname, '../.env');
const envDest = path.join(standaloneDir, '.env');
if (fs.existsSync(envSrc)) {
fs.copyFileSync(envSrc, envDest);
console.log('✓ .env file copied to standalone output');
} else {
console.warn('⚠ .env file not found, skipping...');
console.warn(' Pastikan DATABASE_URL di-set di system environment server!');
}
// Copy .env-local file jika ada (opsional)
const envLocalSrc = path.join(__dirname, '../.env-local');
const envLocalDest = path.join(standaloneDir, '.env-local');
if (fs.existsSync(envLocalSrc)) {
fs.copyFileSync(envLocalSrc, envLocalDest);
console.log('✓ .env-local file copied to standalone output');
}
console.log('✅ Postbuild script completed!');
console.log('');
console.log('📋 Penting untuk Production:');
console.log(' - Pastikan DATABASE_URL tersedia di environment server, ATAU');
console.log(' - File .env sudah ter-copy ke /app/.env di server');

View File

@@ -14,8 +14,6 @@ export async function POST(req: Request) {
try {
const { data } = await req.json();
console.log("data >>", data);
const cekUsername = await prisma.user.findUnique({
where: {
username: data.username,
@@ -29,12 +27,12 @@ export async function POST(req: Request) {
});
// ✅ Validasi wajib setuju Terms
if (data.termsOfServiceAccepted !== true) {
return NextResponse.json({
success: false,
message: "You must agree to the Terms of Service",
});
}
// if (data.termsOfServiceAccepted !== true) {
// return NextResponse.json({
// success: false,
// message: "You must agree to the Terms of Service",
// });
// }
const createUser = await prisma.user.create({
data: {

View File

@@ -28,13 +28,10 @@ export default function Login({ version }: { version: string }) {
const [countryCode, setCountryCode] = useState<string>("62"); // default ke Indonesia
async function onLogin() {
console.log("phone >>", phone);
const nomor = phone;
if (nomor.length <= 4) return setError(true);
const fixPhone = `${countryCode}${nomor}`;
console.log("fixPhone >>", fixPhone);
try {
setLoading(true);
@@ -46,7 +43,6 @@ export default function Login({ version }: { version: string }) {
router.push("/validasi", { scroll: false });
} else {
setLoading(false);
console.log("respone >>", respone);
ComponentGlobal_NotifikasiPeringatan(respone?.message);
}
} catch (error) {
@@ -108,9 +104,6 @@ export default function Login({ version }: { version: string }) {
// Simpan hasil akhir
setCountryCode(dialCode);
setPhone(localNumber);
// console.log("Country Code:", dialCode);
// console.log("Clean Local Number:", localNumber);
}}
/>

View File

@@ -25,15 +25,21 @@ export default function WaitingRoom_View({
const [isLoadingHome, setIsLoadingHome] = useState(false);
async function onClickLogout() {
setLoading(true);
const res = await fetch(`/api/auth/logout?id=${userLoginId}`, {
method: "GET",
});
try {
setLoading(true);
const res = await fetch(`/api/auth/logout?id=${userLoginId}`, {
method: "GET",
});
const result = await res.json();
if (res.status === 200) {
ComponentGlobal_NotifikasiBerhasil(result.message);
router.push("/", { scroll: false });
const result = await res.json();
if (res.status === 200) {
ComponentGlobal_NotifikasiBerhasil(result.message);
router.push("/", { scroll: false });
}
} catch (error) {
console.error("Error button to home", error);
} finally {
setLoading(false);
}
}
@@ -83,7 +89,8 @@ export default function WaitingRoom_View({
</Text>
<Text fw={"bold"} c={"white"} align="center">
Harap tunggu, Anda akan menerima pemberitahuan melalui
Whatsapp setelah disetujui.
Whatsapp setelah disetujui, untuk sementara anda bisa
menunggu pada halaman ini atau keluar.
</Text>
</Stack>
{isAccess && (
@@ -110,6 +117,10 @@ export default function WaitingRoom_View({
Home
</Button>
)}
<Button color="red" loading={loading} onClick={onClickLogout}>
Keluar
</Button>
</Stack>
)}
</ComponentGlobal_CardStyles>

View File

@@ -8,15 +8,43 @@ declare global {
let prisma: PrismaClient;
// Validasi DATABASE_URL sebelum inisialisasi
if (!process.env.DATABASE_URL) {
console.error('❌ ERROR: DATABASE_URL tidak ditemukan di environment variables!');
console.error('');
console.error('Current working directory:', process.cwd());
console.error('Available environment variables:', Object.keys(process.env).sort().join(', '));
console.error('');
console.error('Solusi:');
console.error(' 1. Pastikan file .env ada dan berisi DATABASE_URL, ATAU');
console.error(' 2. Set DATABASE_URL di system environment:');
console.error(' export DATABASE_URL="postgresql://user:pass@host:port/dbname"');
console.error(' 3. Jika menggunakan systemd service, tambahkan di file service:');
console.error(' [Service]');
console.error(' Environment=DATABASE_URL=postgresql://...');
console.error('');
throw new Error('DATABASE_URL is required but not found in environment variables');
}
if (process.env.NODE_ENV === "production") {
prisma = new PrismaClient({
// Reduce logging in production to improve performance
log: ['error', 'warn'],
datasources: {
db: {
url: process.env.DATABASE_URL,
},
},
});
} else {
if (!global.prisma) {
global.prisma = new PrismaClient({
log: ['error', 'warn', 'info', 'query'], // More verbose logging in development
datasources: {
db: {
url: process.env.DATABASE_URL,
},
},
});
}
prisma = global.prisma;

View File

@@ -65,7 +65,7 @@ export const middleware = async (req: NextRequest) => {
const { pathname } = req.nextUrl;
const apiBaseUrl = new URL(req.url).origin || process.env.NEXT_PUBLIC_API_URL;
const apiBaseUrl = process.env.NEXT_PUBLIC_API_URL || new URL(req.url).origin;
// Removed excessive logging that was causing high CPU usage
// const dbUrl = process.env.DATABASE_URL;
// console.log("DATABASE_URL >>", dbUrl);

4
types/env.d.ts vendored
View File

@@ -11,5 +11,9 @@ declare namespace NodeJS {
NEXT_PUBLIC_BASE_SESSION_KEY?: string;
RESEND_APIKEY?: string;
WA_SERVER_TOKEN?: string;
FIREBASE_ADMIN_PRIVATE_KEY?: string;
FIREBASE_ADMIN_CLIENT_EMAIL?: string;
FIREBASE_ADMIN_PROJECT_ID?: string;
NEXT_PUBLIC_API_URL?: string;
}
}