From 5230a319421fe63e3d60757a91ea24549523ec22 Mon Sep 17 00:00:00 2001 From: bipproduction Date: Fri, 6 Mar 2026 11:28:37 +0800 Subject: [PATCH] fix: add custom 404 and global error pages for Docker build Create not-found.tsx and global-error.tsx to prevent Next.js from falling back to legacy Pages Router _error pages during static generation, which fail with useContext null in Docker. Co-Authored-By: Claude Opus 4.6 --- src/app/global-error.tsx | 41 ++++++++++++++++++++++++++++++++++++++++ src/app/not-found.tsx | 24 +++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 src/app/global-error.tsx create mode 100644 src/app/not-found.tsx diff --git a/src/app/global-error.tsx b/src/app/global-error.tsx new file mode 100644 index 0000000..bb62d25 --- /dev/null +++ b/src/app/global-error.tsx @@ -0,0 +1,41 @@ +"use client"; + +export default function GlobalError({ + reset, +}: { + error: Error & { digest?: string }; + reset: () => void; +}) { + return ( + + +

Terjadi Kesalahan

+ + + + ); +} diff --git a/src/app/not-found.tsx b/src/app/not-found.tsx new file mode 100644 index 0000000..9e129d3 --- /dev/null +++ b/src/app/not-found.tsx @@ -0,0 +1,24 @@ +import { Box, Text, Button } from "@mantine/core"; +import Link from "next/link"; + +export default function NotFound() { + return ( + + + 404 - Halaman Tidak Ditemukan + + + + ); +}