fix middleware
This commit is contained in:
@@ -2,3 +2,22 @@
|
||||
{"digest":"DYNAMIC_SERVER_USAGE","level":"error","message":"Error get data detail event: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error","stack":"Error: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error\n at Object.e_ [as staticGenerationBailout] (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:27571)\n at i (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32508)\n at Object.get (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32604)\n at GET (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1219)\n at /Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:39715\n at /Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/server/lib/trace/tracer.js:121:36\n at NoopContextManager.with (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7057)\n at ContextAPI.with (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:516)\n at NoopTracer.startActiveSpan (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18086)\n at ProxyTracer.startActiveSpan (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18847)","timestamp":"2025-02-05T02:44:11.043Z"}
|
||||
{"digest":"DYNAMIC_SERVER_USAGE","level":"error","message":"Error get data detail event: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error","stack":"Error: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error\n at Object.e_ [as staticGenerationBailout] (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:27571)\n at i (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32508)\n at Object.get (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32604)\n at GET (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1219)\n at /Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:39715\n at /Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/server/lib/trace/tracer.js:121:36\n at NoopContextManager.with (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7057)\n at ContextAPI.with (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:516)\n at NoopTracer.startActiveSpan (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18086)\n at ProxyTracer.startActiveSpan (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18847)","timestamp":"2025-02-05T03:13:24.349Z"}
|
||||
{"digest":"DYNAMIC_SERVER_USAGE","level":"error","message":"Error get data detail event: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error","stack":"Error: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error\n at new eS (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:26724)\n at e_ (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:27574)\n at i (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32507)\n at get (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32603)\n at <anonymous> (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js)\n at GET (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js)\n at <anonymous> (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:39714)\n at <anonymous> (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:33303)\n at <anonymous> (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/server/lib/trace/tracer.js:121:36)\n at run (node:async_hooks:64:22)","timestamp":"2025-02-05T03:48:26.606Z"}
|
||||
{"clientVersion":"6.3.0","code":"UND_ERR_SOCKET","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.deleteMany()` invocation:\n\n\nother side closed","meta":{"modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.deleteMany()` invocation:\n\n\nother side closed\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T04:24:29.510Z"}
|
||||
{"clientVersion":"6.3.0","code":"UND_ERR_SOCKET","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.deleteMany()` invocation:\n\n\nother side closed","meta":{"modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.deleteMany()` invocation:\n\n\nother side closed\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T05:56:01.792Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:24:33.579Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:24:38.069Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:24:39.386Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:24:40.316Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:24:41.037Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:24:41.842Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:24:42.615Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:24:42.784Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:24:42.982Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:24:43.131Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:24:43.278Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:25:00.025Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:25:00.028Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:25:00.029Z"}
|
||||
{"clientVersion":"6.3.0","code":"UND_ERR_SOCKET","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nother side closed","meta":{"modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nother side closed\n at new PrismaClientKnownRequestError (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:148:1500)\n at handleRequestError (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:258:7367)\n at handleAndLogRequestError (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:258:6687)\n at <anonymous> (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:258:6394)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:35:53.417Z"}
|
||||
{"id":"c65237f0-e0cf-4961-9454-2405c4f4fe05","level":"info","message":"Success send message","status":"success","timestamp":"2025-02-05T06:41:30.785Z"}
|
||||
{"clientVersion":"6.3.0","code":"UND_ERR_SOCKET","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nother side closed","meta":{"modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nother side closed\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:53:59.012Z"}
|
||||
|
||||
@@ -2,3 +2,21 @@
|
||||
{"digest":"DYNAMIC_SERVER_USAGE","level":"error","message":"Error get data detail event: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error","stack":"Error: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error\n at Object.e_ [as staticGenerationBailout] (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:27571)\n at i (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32508)\n at Object.get (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32604)\n at GET (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1219)\n at /Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:39715\n at /Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/server/lib/trace/tracer.js:121:36\n at NoopContextManager.with (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7057)\n at ContextAPI.with (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:516)\n at NoopTracer.startActiveSpan (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18086)\n at ProxyTracer.startActiveSpan (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18847)","timestamp":"2025-02-05T02:44:11.043Z"}
|
||||
{"digest":"DYNAMIC_SERVER_USAGE","level":"error","message":"Error get data detail event: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error","stack":"Error: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error\n at Object.e_ [as staticGenerationBailout] (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:27571)\n at i (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32508)\n at Object.get (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32604)\n at GET (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1219)\n at /Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:39715\n at /Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/server/lib/trace/tracer.js:121:36\n at NoopContextManager.with (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7057)\n at ContextAPI.with (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:516)\n at NoopTracer.startActiveSpan (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18086)\n at ProxyTracer.startActiveSpan (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18847)","timestamp":"2025-02-05T03:13:24.349Z"}
|
||||
{"digest":"DYNAMIC_SERVER_USAGE","level":"error","message":"Error get data detail event: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error","stack":"Error: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error\n at new eS (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:26724)\n at e_ (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:27574)\n at i (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32507)\n at get (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32603)\n at <anonymous> (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js)\n at GET (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js)\n at <anonymous> (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:39714)\n at <anonymous> (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:33303)\n at <anonymous> (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/server/lib/trace/tracer.js:121:36)\n at run (node:async_hooks:64:22)","timestamp":"2025-02-05T03:48:26.606Z"}
|
||||
{"clientVersion":"6.3.0","code":"UND_ERR_SOCKET","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.deleteMany()` invocation:\n\n\nother side closed","meta":{"modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.deleteMany()` invocation:\n\n\nother side closed\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T04:24:29.510Z"}
|
||||
{"clientVersion":"6.3.0","code":"UND_ERR_SOCKET","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.deleteMany()` invocation:\n\n\nother side closed","meta":{"modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.deleteMany()` invocation:\n\n\nother side closed\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T05:56:01.792Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:24:33.579Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:24:38.069Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:24:39.386Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:24:40.316Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:24:41.037Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:24:41.842Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:24:42.615Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:24:42.784Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:24:42.982Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:24:43.131Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:24:43.278Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:25:00.025Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:25:00.028Z"}
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:25:00.029Z"}
|
||||
{"clientVersion":"6.3.0","code":"UND_ERR_SOCKET","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nother side closed","meta":{"modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nother side closed\n at new PrismaClientKnownRequestError (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:148:1500)\n at handleRequestError (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:258:7367)\n at handleAndLogRequestError (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:258:6687)\n at <anonymous> (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:258:6394)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:35:53.417Z"}
|
||||
{"clientVersion":"6.3.0","code":"UND_ERR_SOCKET","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nother side closed","meta":{"modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nother side closed\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:53:59.012Z"}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
import { prisma } from "@/app/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export { DELETE };
|
||||
async function DELETE(request: Request) {
|
||||
async function DELETE(
|
||||
request: Request,
|
||||
{ params }: { params: { id: string } }
|
||||
) {
|
||||
if (request.method !== "DELETE") {
|
||||
return NextResponse.json(
|
||||
{ success: false, message: "Method not allowed" },
|
||||
@@ -10,41 +14,24 @@ async function DELETE(request: Request) {
|
||||
);
|
||||
}
|
||||
try {
|
||||
// Ambil parameter nomor dari URL
|
||||
const { nomor } = await request.json();
|
||||
// Ambil parameter id dari URL
|
||||
const { id } = params;
|
||||
|
||||
// Validasi parameter nomor
|
||||
if (!nomor) {
|
||||
if (!id) {
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Parameter 'nomor' diperlukan",
|
||||
message: "Parameter 'id' diperlukan",
|
||||
},
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
// Cek apakah data OTP dengan nomor tersebut ada
|
||||
const existingOtp = await prisma.kodeOtp.findFirst({
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: { nomor },
|
||||
});
|
||||
|
||||
if (!existingOtp) {
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Data OTP tidak ditemukan",
|
||||
},
|
||||
{ status: 404 }
|
||||
);
|
||||
}
|
||||
|
||||
// Hapus data OTP
|
||||
await prisma.kodeOtp.deleteMany({
|
||||
where: { nomor },
|
||||
await prisma.kodeOtp.delete({
|
||||
where: {
|
||||
id: id,
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json(
|
||||
@@ -55,7 +42,7 @@ async function DELETE(request: Request) {
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.error("Error deleting OTP:", error);
|
||||
backendLogger.error("Error deleting OTP:", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
@@ -32,7 +32,6 @@ export async function GET(req: NextRequest) {
|
||||
});
|
||||
|
||||
// Disconnect after successful query
|
||||
await prisma.$disconnect();
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
@@ -41,7 +40,6 @@ export async function GET(req: NextRequest) {
|
||||
});
|
||||
} catch (error) {
|
||||
// Ensure connection is closed even if error occurs
|
||||
await prisma.$disconnect();
|
||||
|
||||
console.error("Error in user validation:", error);
|
||||
return NextResponse.json(
|
||||
@@ -51,5 +49,7 @@ export async function GET(req: NextRequest) {
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
} finally {
|
||||
await prisma.$disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
|
||||
export async function GET(req: Request) {
|
||||
const auth = req.headers.get("Authorization");
|
||||
const token = auth?.split(" ")[1];
|
||||
console.log("TOKEN>", token);
|
||||
if (!token) return NextResponse.json({ success: false }, { status: 401 });
|
||||
|
||||
return NextResponse.json({ success: true });
|
||||
|
||||
@@ -35,18 +35,15 @@ const apiPostVerifikasiCodeOtp = async ({ nomor }: { nomor: string }) => {
|
||||
return await respone.json().catch(() => null);
|
||||
};
|
||||
|
||||
const apiDeleteAktivasiKodeOtpByNomor = async ({
|
||||
nomor,
|
||||
}: {
|
||||
nomor: string;
|
||||
}) => {
|
||||
const respone = await fetch(`/api/auth/code`, {
|
||||
const apiDeleteAktivasiKodeOtpByNomor = async ({ id }: { id: string }) => {
|
||||
const respone = await fetch(`/api/auth/code/${id}`, {
|
||||
method: "DELETE",
|
||||
body: JSON.stringify({nomor}),
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
console.log("respone delete", await respone.json());
|
||||
|
||||
return await respone.json().catch(() => null);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { RouterAdminDashboard } from "@/app/lib/router_hipmi/router_admin";
|
||||
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
||||
import {
|
||||
AccentColor,
|
||||
MainColor,
|
||||
@@ -26,12 +25,9 @@ import { useRouter } from "next/navigation";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global";
|
||||
import { auth_funDeleteAktivasiKodeOtpByNomor } from "../fun/fun_edit_aktivasi_kode_otp_by_id";
|
||||
import Validasi_SkeletonView from "./skeleton";
|
||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||
import { clientLogger } from "@/util/clientLogger";
|
||||
import { IconChevronLeft } from "@tabler/icons-react";
|
||||
import _ from "lodash";
|
||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||
import {
|
||||
apiDeleteAktivasiKodeOtpByNomor,
|
||||
apiGetCheckCodeOtp,
|
||||
@@ -46,6 +42,7 @@ export default function Validasi() {
|
||||
const [counter, setCounter] = useState(60);
|
||||
const [loadingResend, setLoadingResend] = useState(false);
|
||||
const [triggerOtp, setTriggerOtp] = useState(false);
|
||||
const [idCode, setIdCode] = useState("");
|
||||
|
||||
const [data, setData] = useState({
|
||||
nomor: "",
|
||||
@@ -74,7 +71,9 @@ export default function Validasi() {
|
||||
async function onCheckAuthCode({ kodeId }: { kodeId: string }) {
|
||||
try {
|
||||
const respone = await apiGetCheckCodeOtp({ id: kodeId });
|
||||
|
||||
if (respone) {
|
||||
setIdCode(kodeId);
|
||||
setData({
|
||||
nomor: respone.nomor,
|
||||
code: respone.otp,
|
||||
@@ -101,21 +100,21 @@ export default function Validasi() {
|
||||
|
||||
if (respone && respone.success == true) {
|
||||
if (respone.roleId == "1") {
|
||||
router.push("/login", { scroll: false });
|
||||
ComponentGlobal_NotifikasiBerhasil(respone.message);
|
||||
localStorage.removeItem("hipmi_auth_code_id");
|
||||
|
||||
router.push(RouterHome.main_home, { scroll: false });
|
||||
} else if (respone.roleId != "1") {
|
||||
ComponentGlobal_NotifikasiBerhasil("Admin berhasil login");
|
||||
localStorage.removeItem("hipmi_auth_code_id");
|
||||
|
||||
router.push(RouterAdminDashboard.splash_admin, { scroll: false });
|
||||
ComponentGlobal_NotifikasiBerhasil("Admin berhasil login");
|
||||
}
|
||||
|
||||
try {
|
||||
const responeDelete = await apiDeleteAktivasiKodeOtpByNomor({
|
||||
nomor: data.nomor,
|
||||
id: idCode,
|
||||
});
|
||||
|
||||
if (responeDelete) {
|
||||
localStorage.removeItem("hipmi_auth_code_id");
|
||||
}
|
||||
} catch (error) {
|
||||
clientLogger.error("Error apiDeleteAktivasiKodeOtpByNomor:", error);
|
||||
}
|
||||
@@ -123,47 +122,6 @@ export default function Validasi() {
|
||||
router.push("/register", { scroll: false });
|
||||
ComponentGlobal_NotifikasiBerhasil(respone.message);
|
||||
}
|
||||
|
||||
// if (respone.status === 200 && result.roleId == "1") {
|
||||
// ComponentGlobal_NotifikasiBerhasil(result.message);
|
||||
// localStorage.removeItem("hipmi_auth_code_id");
|
||||
// await auth_funDeleteAktivasiKodeOtpByNomor({
|
||||
// nomor: data.nomor,
|
||||
// });
|
||||
|
||||
// router.push(RouterHome.main_home, { scroll: false });
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if (respone.status === 200 && result.roleId != "1") {
|
||||
// ComponentGlobal_NotifikasiBerhasil("Admin Logged in");
|
||||
// localStorage.removeItem("hipmi_auth_code_id");
|
||||
// await auth_funDeleteAktivasiKodeOtpByNomor({
|
||||
// nomor: data.nomor,
|
||||
// });
|
||||
|
||||
// router.push(RouterAdminDashboard.splash_admin, { scroll: false });
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if (respone.status === 404) {
|
||||
// setLoading(false);
|
||||
// router.push("/register", { scroll: false });
|
||||
// ComponentGlobal_NotifikasiBerhasil(result.message);
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if (respone.status === 400) {
|
||||
// setLoading(false);
|
||||
// ComponentGlobal_NotifikasiPeringatan(result.message);
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if (respone.status == 500) {
|
||||
// setLoading(false);
|
||||
// ComponentGlobal_NotifikasiGagal(result.message);
|
||||
// return;
|
||||
// }
|
||||
} catch (error) {
|
||||
setLoading(false);
|
||||
clientLogger.error("Error validasi:", error);
|
||||
@@ -171,9 +129,19 @@ export default function Validasi() {
|
||||
}
|
||||
|
||||
async function onBack() {
|
||||
localStorage.removeItem("hipmi_auth_code_id");
|
||||
await auth_funDeleteAktivasiKodeOtpByNomor({ nomor: data.nomor });
|
||||
router.back();
|
||||
try {
|
||||
router.back();
|
||||
111;
|
||||
const responeDelete = await apiDeleteAktivasiKodeOtpByNomor({
|
||||
id: idCode,
|
||||
});
|
||||
|
||||
if (responeDelete) {
|
||||
localStorage.removeItem("hipmi_auth_code_id");
|
||||
}
|
||||
} catch (error) {
|
||||
clientLogger.error("Error apiDeleteAktivasiKodeOtpByNomor:", error);
|
||||
}
|
||||
}
|
||||
|
||||
async function onResendCode() {
|
||||
@@ -213,7 +181,7 @@ export default function Validasi() {
|
||||
<>
|
||||
<UIGlobal_LayoutDefault>
|
||||
<Stack h={"100vh"}>
|
||||
{/* <Box
|
||||
<Box
|
||||
pt={"md"}
|
||||
px={"md"}
|
||||
style={{
|
||||
@@ -224,11 +192,11 @@ export default function Validasi() {
|
||||
<ActionIcon variant="transparent" onClick={() => onBack()}>
|
||||
<IconChevronLeft color="white" />
|
||||
</ActionIcon>
|
||||
</Box> */}
|
||||
</Box>
|
||||
|
||||
<Stack align="center" justify="center" h={"100vh"} spacing={50}>
|
||||
<Title order={2} color={MainColor.yellow}>
|
||||
Verifikasi Kode OTP
|
||||
Verifikasi Kode OTP {data.code}
|
||||
</Title>
|
||||
|
||||
<Stack spacing={"md"} align="center">
|
||||
|
||||
@@ -43,8 +43,6 @@ const middlewareConfig: MiddlewareConfig = {
|
||||
// "/api/admin/voting/dashboard/*",
|
||||
// "/api/admin/job/dashboard/*",
|
||||
// "/api/admin/forum/dashboard/*",
|
||||
|
||||
|
||||
|
||||
// Akses awal
|
||||
"/api/get-cookie",
|
||||
@@ -78,135 +76,143 @@ export const middleware = async (req: NextRequest) => {
|
||||
apiPath,
|
||||
encodedKey,
|
||||
loginPath,
|
||||
// validasiPath,
|
||||
// registarasiPath,
|
||||
publicRoutes,
|
||||
sessionKey,
|
||||
validationApiRoute,
|
||||
userPath,
|
||||
} = middlewareConfig;
|
||||
|
||||
const { pathname } = req.nextUrl;
|
||||
|
||||
// CORS handling
|
||||
// Handle CORS
|
||||
const corsResponse = handleCors(req);
|
||||
if (corsResponse) {
|
||||
return setCorsHeaders(corsResponse);
|
||||
return corsResponse;
|
||||
}
|
||||
|
||||
// Skip authentication for public routes
|
||||
const isPublicRoute = [
|
||||
...publicRoutes,
|
||||
loginPath,
|
||||
// validasiPath,
|
||||
// registarasiPath,
|
||||
].some((route) => {
|
||||
const pattern = route.replace(/\*/g, ".*");
|
||||
return new RegExp(`^${pattern}$`).test(pathname);
|
||||
});
|
||||
|
||||
// Always protect validation endpoint
|
||||
if (pathname === validationApiRoute) {
|
||||
const reqToken = req.headers.get("Authorization")?.split(" ")[1];
|
||||
if (!reqToken) {
|
||||
return setCorsHeaders(unauthorizedResponse());
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
isPublicRoute &&
|
||||
pathname !== loginPath
|
||||
// &&
|
||||
// pathname !== validasiPath &&
|
||||
// pathname !== registarasiPath
|
||||
) {
|
||||
// Check if route is public
|
||||
const isPublicRoute = isRoutePublic(pathname, publicRoutes, loginPath);
|
||||
if (isPublicRoute && pathname !== loginPath) {
|
||||
return setCorsHeaders(NextResponse.next());
|
||||
}
|
||||
|
||||
const token =
|
||||
req.cookies.get(sessionKey)?.value ||
|
||||
req.headers.get("Authorization")?.split(" ")[1];
|
||||
// Get token from cookies or Authorization header
|
||||
const token = getToken(req, sessionKey);
|
||||
|
||||
// ==================== Authentication: Login, Validasi, Registrasi ==================== //
|
||||
// Token verification
|
||||
// Verify token and get user data
|
||||
const user = await verifyToken({ token, encodedKey });
|
||||
console.log("middlaware",user)
|
||||
console.log("USER >>", user?.username);
|
||||
|
||||
// Handle login page access
|
||||
if (pathname === loginPath) {
|
||||
if (user) {
|
||||
return setCorsHeaders(NextResponse.redirect(new URL(userPath, req.url)));
|
||||
const response = NextResponse.redirect(new URL(userPath, req.url));
|
||||
// Preserve token in cookie when redirecting
|
||||
if (token) {
|
||||
response.cookies.set(sessionKey, token, {
|
||||
httpOnly: true,
|
||||
secure: process.env.NODE_ENV === "production",
|
||||
sameSite: "lax",
|
||||
path: "/",
|
||||
});
|
||||
}
|
||||
return setCorsHeaders(response);
|
||||
}
|
||||
return setCorsHeaders(NextResponse.next());
|
||||
}
|
||||
|
||||
// // Handle validation page access
|
||||
// if (pathname === validasiPath) {
|
||||
// if (user) {
|
||||
// return setCorsHeaders(NextResponse.redirect(new URL(userPath, req.url)));
|
||||
// }
|
||||
// return setCorsHeaders(NextResponse.next());
|
||||
// }
|
||||
|
||||
// // Handle register page access
|
||||
// if (pathname === registarasiPath) {
|
||||
// if (user) {
|
||||
// return setCorsHeaders(NextResponse.redirect(new URL(userPath, req.url)));
|
||||
// }
|
||||
// return setCorsHeaders(NextResponse.next());
|
||||
// }
|
||||
|
||||
// Handle protected routes
|
||||
// Redirect to login if no user found
|
||||
if (!user) {
|
||||
return setCorsHeaders(NextResponse.redirect(new URL(loginPath, req.url)));
|
||||
const response = NextResponse.redirect(new URL(loginPath, req.url));
|
||||
// Clear invalid token
|
||||
response.cookies.delete(sessionKey);
|
||||
return setCorsHeaders(response);
|
||||
}
|
||||
// ==================== Authentication: Login, Validasi, Registrasi ==================== //
|
||||
|
||||
// Handle /dev routes that require active status
|
||||
if (pathname.startsWith("/dev")) {
|
||||
const userValidate = await fetch(new URL("/api/user-validate", req.url), {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
});
|
||||
|
||||
const userValidateJson = await userValidate.json();
|
||||
|
||||
if (!userValidateJson.data.active) {
|
||||
return setCorsHeaders(
|
||||
NextResponse.redirect(new URL("/waiting-room", req.url))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle authenticated API requests
|
||||
if (pathname.startsWith(apiPath)) {
|
||||
const reqToken = req.headers.get("Authorization")?.split(" ")[1];
|
||||
if (!reqToken) {
|
||||
return setCorsHeaders(unauthorizedResponse());
|
||||
}
|
||||
|
||||
// Validate user access with external API
|
||||
const validationResponse = await fetch(
|
||||
new URL(validationApiRoute, req.url),
|
||||
{
|
||||
try {
|
||||
const userValidate = await fetch(new URL("/api/user-validate", req.url), {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${reqToken}`,
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
if (!validationResponse.ok) {
|
||||
if (!userValidate.ok) {
|
||||
throw new Error("Failed to validate user");
|
||||
}
|
||||
|
||||
const userValidateJson = await userValidate.json();
|
||||
|
||||
if (!userValidateJson.data.active) {
|
||||
return setCorsHeaders(
|
||||
NextResponse.redirect(new URL("/waiting-room", req.url))
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error validating user:", error);
|
||||
return setCorsHeaders(unauthorizedResponse());
|
||||
}
|
||||
}
|
||||
|
||||
// Handle API requests
|
||||
if (pathname.startsWith(apiPath)) {
|
||||
if (!token) {
|
||||
return setCorsHeaders(unauthorizedResponse());
|
||||
}
|
||||
|
||||
const dataJson = await validationResponse.json();
|
||||
try {
|
||||
const validationResponse = await fetch(
|
||||
new URL(validationApiRoute, req.url),
|
||||
{
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
if (!validationResponse.ok) {
|
||||
throw new Error("Failed to validate API request");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error validating API request:", error);
|
||||
return setCorsHeaders(unauthorizedResponse());
|
||||
}
|
||||
}
|
||||
|
||||
// Proceed with the request
|
||||
return setCorsHeaders(NextResponse.next());
|
||||
const response = NextResponse.next();
|
||||
// Ensure token is preserved in cookie
|
||||
if (token) {
|
||||
response.cookies.set(sessionKey, token, {
|
||||
httpOnly: true,
|
||||
secure: process.env.NODE_ENV === "production",
|
||||
sameSite: "lax",
|
||||
path: "/",
|
||||
});
|
||||
}
|
||||
return setCorsHeaders(response);
|
||||
};
|
||||
|
||||
function isRoutePublic(
|
||||
pathname: string,
|
||||
publicRoutes: string[],
|
||||
loginPath: string
|
||||
): boolean {
|
||||
return [...publicRoutes, loginPath].some((route) => {
|
||||
const pattern = route.replace(/\*/g, ".*");
|
||||
return new RegExp(`^${pattern}$`).test(pathname);
|
||||
});
|
||||
}
|
||||
|
||||
function getToken(req: NextRequest, sessionKey: string): string | undefined {
|
||||
return (
|
||||
req.cookies.get(sessionKey)?.value ||
|
||||
req.headers.get("Authorization")?.split(" ")[1]
|
||||
);
|
||||
}
|
||||
|
||||
function unauthorizedResponse(): NextResponse {
|
||||
return new NextResponse(JSON.stringify({ error: "Unauthorized" }), {
|
||||
status: 401,
|
||||
@@ -251,16 +257,6 @@ async function verifyToken({
|
||||
}): Promise<Record<string, unknown> | null> {
|
||||
if (!token) return null;
|
||||
|
||||
return await decrypt({ token, encodedKey });
|
||||
}
|
||||
|
||||
async function decrypt({
|
||||
token,
|
||||
encodedKey,
|
||||
}: {
|
||||
token: string;
|
||||
encodedKey: string;
|
||||
}): Promise<Record<string, any> | null> {
|
||||
try {
|
||||
const enc = new TextEncoder().encode(encodedKey);
|
||||
const { payload } = await jwtVerify(token, enc, {
|
||||
@@ -268,7 +264,7 @@ async function decrypt({
|
||||
});
|
||||
return (payload.user as Record<string, any>) || null;
|
||||
} catch (error) {
|
||||
console.error("Gagal verifikasi session", error);
|
||||
console.error("Token verification failed:", error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -276,5 +272,3 @@ async function decrypt({
|
||||
export const config = {
|
||||
matcher: ["/((?!_next|static|favicon.ico|manifest).*)"],
|
||||
};
|
||||
|
||||
// wibu:0.2.82
|
||||
|
||||
284
src/middleware.v2.back.txt
Normal file
284
src/middleware.v2.back.txt
Normal file
@@ -0,0 +1,284 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { jwtVerify } from "jose";
|
||||
import { apies, pages } from "./lib/routes";
|
||||
|
||||
type MiddlewareConfig = {
|
||||
apiPath: string;
|
||||
loginPath: string;
|
||||
// validasiPath: string;
|
||||
// registarasiPath: string;
|
||||
userPath: string;
|
||||
publicRoutes: string[];
|
||||
encodedKey: string;
|
||||
sessionKey: string;
|
||||
validationApiRoute: string;
|
||||
log: boolean;
|
||||
};
|
||||
|
||||
const middlewareConfig: MiddlewareConfig = {
|
||||
apiPath: "/api",
|
||||
loginPath: "/login",
|
||||
// validasiPath: "/validasi",
|
||||
// registarasiPath: "/register",
|
||||
userPath: "/dev/home",
|
||||
publicRoutes: [
|
||||
// API
|
||||
"/",
|
||||
"/api/voting/*",
|
||||
"/api/collaboration/*",
|
||||
"/api/notifikasi/*",
|
||||
"/api/logs/*",
|
||||
"/api/job/*",
|
||||
"/api/auth/*",
|
||||
"/api/origin-url",
|
||||
"/api/event/*",
|
||||
// "/api/master/*",
|
||||
// "/api/image/*",
|
||||
// "/api/user/*",
|
||||
// "/api/new/*",
|
||||
// ADMIN API
|
||||
// "/api/admin/event/*",
|
||||
// "/api/admin/investasi/*",
|
||||
// "/api/admin/donasi/dashboard/*",
|
||||
// "/api/admin/voting/dashboard/*",
|
||||
// "/api/admin/job/dashboard/*",
|
||||
// "/api/admin/forum/dashboard/*",
|
||||
|
||||
// Akses awal
|
||||
"/api/get-cookie",
|
||||
"/api/user/activation",
|
||||
"/api/user-validate",
|
||||
|
||||
// PAGE
|
||||
"/login",
|
||||
"/register",
|
||||
"/validasi",
|
||||
"/splash",
|
||||
"/job-vacancy",
|
||||
"/preview-image",
|
||||
"/auth/login",
|
||||
"/auth/api/login",
|
||||
"/waiting-room",
|
||||
"/zCoba/*",
|
||||
|
||||
// ASSETS
|
||||
"/aset/global/main_background.png",
|
||||
"/aset/logo/logo-hipmi.png",
|
||||
],
|
||||
encodedKey: process.env.NEXT_PUBLIC_BASE_TOKEN_KEY!,
|
||||
sessionKey: process.env.NEXT_PUBLIC_BASE_SESSION_KEY!,
|
||||
validationApiRoute: "/api/validation",
|
||||
log: false,
|
||||
};
|
||||
|
||||
export const middleware = async (req: NextRequest) => {
|
||||
const {
|
||||
apiPath,
|
||||
encodedKey,
|
||||
loginPath,
|
||||
// validasiPath,
|
||||
// registarasiPath,
|
||||
publicRoutes,
|
||||
sessionKey,
|
||||
validationApiRoute,
|
||||
userPath,
|
||||
} = middlewareConfig;
|
||||
const { pathname } = req.nextUrl;
|
||||
|
||||
// CORS handling
|
||||
const corsResponse = handleCors(req);
|
||||
if (corsResponse) {
|
||||
return setCorsHeaders(corsResponse);
|
||||
}
|
||||
|
||||
// Skip authentication for public routes
|
||||
const isPublicRoute = [
|
||||
...publicRoutes,
|
||||
loginPath,
|
||||
// validasiPath,
|
||||
// registarasiPath,
|
||||
].some((route) => {
|
||||
const pattern = route.replace(/\*/g, ".*");
|
||||
return new RegExp(`^${pattern}$`).test(pathname);
|
||||
});
|
||||
|
||||
// Always protect validation endpoint
|
||||
if (pathname === validationApiRoute) {
|
||||
const reqToken = req.headers.get("Authorization")?.split(" ")[1];
|
||||
if (!reqToken) {
|
||||
return setCorsHeaders(unauthorizedResponse());
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
isPublicRoute &&
|
||||
pathname !== loginPath
|
||||
// &&
|
||||
// pathname !== validasiPath &&
|
||||
// pathname !== registarasiPath
|
||||
) {
|
||||
return setCorsHeaders(NextResponse.next());
|
||||
}
|
||||
|
||||
const token =
|
||||
req.cookies.get(sessionKey)?.value ||
|
||||
req.headers.get("Authorization")?.split(" ")[1];
|
||||
|
||||
// ==================== Authentication: Login, Validasi, Registrasi ==================== //
|
||||
// Token verification
|
||||
const user = await verifyToken({ token, encodedKey });
|
||||
console.log("middlaware console:", user);
|
||||
|
||||
// Handle login page access
|
||||
if (pathname === loginPath) {
|
||||
console.log("cek pathname >>", pathname);
|
||||
if (user) {
|
||||
console.log("sudah login, cek user >>", user);
|
||||
return setCorsHeaders(NextResponse.redirect(new URL(userPath, req.url)));
|
||||
}
|
||||
return setCorsHeaders(NextResponse.next());
|
||||
}
|
||||
|
||||
if (!user) {
|
||||
return setCorsHeaders(NextResponse.redirect(new URL(loginPath, req.url)));
|
||||
}
|
||||
|
||||
// // Handle validation page access
|
||||
// if (pathname === validasiPath) {
|
||||
// if (user) {
|
||||
// return setCorsHeaders(NextResponse.redirect(new URL(userPath, req.url)));
|
||||
// }
|
||||
// return setCorsHeaders(NextResponse.next());
|
||||
// }
|
||||
|
||||
// // Handle register page access
|
||||
// if (pathname === registarasiPath) {
|
||||
// if (user) {
|
||||
// return setCorsHeaders(NextResponse.redirect(new URL(userPath, req.url)));
|
||||
// }
|
||||
// return setCorsHeaders(NextResponse.next());
|
||||
// }
|
||||
|
||||
// Handle protected routes
|
||||
// if (!user) {
|
||||
// return setCorsHeaders(NextResponse.redirect(new URL(loginPath, req.url)));
|
||||
// }
|
||||
// ==================== Authentication: Login, Validasi, Registrasi ==================== //
|
||||
|
||||
if (pathname.startsWith("/dev")) {
|
||||
const userValidate = await fetch(new URL("/api/user-validate", req.url), {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
});
|
||||
|
||||
const userValidateJson = await userValidate.json();
|
||||
|
||||
if (!userValidateJson.data.active) {
|
||||
return setCorsHeaders(
|
||||
NextResponse.redirect(new URL("/waiting-room", req.url))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle authenticated API requests
|
||||
if (pathname.startsWith(apiPath)) {
|
||||
const reqToken = req.headers.get("Authorization")?.split(" ")[1];
|
||||
if (!reqToken) {
|
||||
return setCorsHeaders(unauthorizedResponse());
|
||||
}
|
||||
|
||||
// Validate user access with external API
|
||||
const validationResponse = await fetch(
|
||||
new URL(validationApiRoute, req.url),
|
||||
{
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${reqToken}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
if (!validationResponse.ok) {
|
||||
return setCorsHeaders(unauthorizedResponse());
|
||||
}
|
||||
|
||||
const dataJson = await validationResponse.json();
|
||||
}
|
||||
|
||||
// Proceed with the request
|
||||
return setCorsHeaders(NextResponse.next());
|
||||
};
|
||||
|
||||
function unauthorizedResponse(): NextResponse {
|
||||
return new NextResponse(JSON.stringify({ error: "Unauthorized" }), {
|
||||
status: 401,
|
||||
headers: { "Content-Type": "application/json" },
|
||||
});
|
||||
}
|
||||
|
||||
function setCorsHeaders(res: NextResponse): NextResponse {
|
||||
res.headers.set("Access-Control-Allow-Origin", "*");
|
||||
res.headers.set(
|
||||
"Access-Control-Allow-Methods",
|
||||
"GET, POST, PUT, DELETE, OPTIONS"
|
||||
);
|
||||
res.headers.set(
|
||||
"Access-Control-Allow-Headers",
|
||||
"Content-Type, Authorization"
|
||||
);
|
||||
return res;
|
||||
}
|
||||
|
||||
function handleCors(req: NextRequest): NextResponse | null {
|
||||
if (req.method === "OPTIONS") {
|
||||
return new NextResponse(null, {
|
||||
status: 204,
|
||||
headers: {
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
|
||||
"Access-Control-Allow-Headers": "Content-Type, Authorization",
|
||||
"Access-Control-Max-Age": "86400",
|
||||
},
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
async function verifyToken({
|
||||
token,
|
||||
encodedKey,
|
||||
}: {
|
||||
token: string | undefined;
|
||||
encodedKey: string;
|
||||
}): Promise<Record<string, unknown> | null> {
|
||||
if (!token) return null;
|
||||
|
||||
return await decrypt({ token, encodedKey });
|
||||
}
|
||||
|
||||
async function decrypt({
|
||||
token,
|
||||
encodedKey,
|
||||
}: {
|
||||
token: string;
|
||||
encodedKey: string;
|
||||
}): Promise<Record<string, any> | null> {
|
||||
try {
|
||||
const enc = new TextEncoder().encode(encodedKey);
|
||||
const { payload } = await jwtVerify(token, enc, {
|
||||
algorithms: ["HS256"],
|
||||
});
|
||||
return (payload.user as Record<string, any>) || null;
|
||||
} catch (error) {
|
||||
console.error("Gagal verifikasi session", error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: ["/((?!_next|static|favicon.ico|manifest).*)"],
|
||||
};
|
||||
|
||||
// wibu:0.2.82
|
||||
244
src/middleware.v3.back.txt
Normal file
244
src/middleware.v3.back.txt
Normal file
@@ -0,0 +1,244 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { jwtVerify } from "jose";
|
||||
|
||||
type MiddlewareConfig = {
|
||||
apiPath: string;
|
||||
loginPath: string;
|
||||
userPath: string;
|
||||
publicRoutes: string[];
|
||||
encodedKey: string;
|
||||
sessionKey: string;
|
||||
validationApiRoute: string;
|
||||
log: boolean;
|
||||
};
|
||||
|
||||
const middlewareConfig: MiddlewareConfig = {
|
||||
apiPath: "/api",
|
||||
loginPath: "/login",
|
||||
userPath: "/dev/home",
|
||||
publicRoutes: [
|
||||
"/",
|
||||
"/api/voting/*",
|
||||
"/api/collaboration/*",
|
||||
"/api/notifikasi/*",
|
||||
"/api/logs/*",
|
||||
"/api/job/*",
|
||||
"/api/auth/*",
|
||||
"/api/origin-url",
|
||||
"/api/event/*",
|
||||
"/api/get-cookie",
|
||||
"/api/user/activation",
|
||||
"/api/user-validate",
|
||||
"/login",
|
||||
"/register",
|
||||
"/validasi",
|
||||
"/splash",
|
||||
"/job-vacancy",
|
||||
"/preview-image",
|
||||
"/auth/login",
|
||||
"/auth/api/login",
|
||||
"/waiting-room",
|
||||
"/zCoba/*",
|
||||
"/aset/global/main_background.png",
|
||||
"/aset/logo/logo-hipmi.png",
|
||||
],
|
||||
encodedKey: process.env.NEXT_PUBLIC_BASE_TOKEN_KEY!,
|
||||
sessionKey: process.env.NEXT_PUBLIC_BASE_SESSION_KEY!,
|
||||
validationApiRoute: "/api/validation",
|
||||
log: false,
|
||||
};
|
||||
|
||||
export const middleware = async (req: NextRequest) => {
|
||||
const {
|
||||
apiPath,
|
||||
encodedKey,
|
||||
loginPath,
|
||||
publicRoutes,
|
||||
sessionKey,
|
||||
validationApiRoute,
|
||||
userPath,
|
||||
} = middlewareConfig;
|
||||
|
||||
const { pathname } = req.nextUrl;
|
||||
|
||||
// Handle CORS
|
||||
const corsResponse = handleCors(req);
|
||||
if (corsResponse) {
|
||||
return corsResponse;
|
||||
}
|
||||
|
||||
// Check if route is public
|
||||
const isPublicRoute = isRoutePublic(pathname, publicRoutes, loginPath);
|
||||
if (isPublicRoute && pathname !== loginPath) {
|
||||
return setCorsHeaders(NextResponse.next());
|
||||
}
|
||||
|
||||
// Get token from cookies or Authorization header
|
||||
const token = getToken(req, sessionKey);
|
||||
|
||||
// Verify token and get user data
|
||||
const user = await verifyToken({ token, encodedKey });
|
||||
|
||||
// Handle login page access
|
||||
if (pathname === loginPath) {
|
||||
if (user) {
|
||||
const response = NextResponse.redirect(new URL(userPath, req.url));
|
||||
// Preserve token in cookie when redirecting
|
||||
if (token) {
|
||||
response.cookies.set(sessionKey, token, {
|
||||
httpOnly: true,
|
||||
secure: process.env.NODE_ENV === 'production',
|
||||
sameSite: 'lax',
|
||||
path: '/'
|
||||
});
|
||||
}
|
||||
return setCorsHeaders(response);
|
||||
}
|
||||
return setCorsHeaders(NextResponse.next());
|
||||
}
|
||||
|
||||
// Redirect to login if no user found
|
||||
if (!user) {
|
||||
const response = NextResponse.redirect(new URL(loginPath, req.url));
|
||||
// Clear invalid token
|
||||
response.cookies.delete(sessionKey);
|
||||
return setCorsHeaders(response);
|
||||
}
|
||||
|
||||
// Handle /dev routes that require active status
|
||||
if (pathname.startsWith("/dev")) {
|
||||
try {
|
||||
const userValidate = await fetch(new URL("/api/user-validate", req.url), {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
});
|
||||
|
||||
if (!userValidate.ok) {
|
||||
throw new Error('Failed to validate user');
|
||||
}
|
||||
|
||||
const userValidateJson = await userValidate.json();
|
||||
|
||||
if (!userValidateJson.data.active) {
|
||||
return setCorsHeaders(
|
||||
NextResponse.redirect(new URL("/waiting-room", req.url))
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error validating user:', error);
|
||||
return setCorsHeaders(unauthorizedResponse());
|
||||
}
|
||||
}
|
||||
|
||||
// Handle API requests
|
||||
if (pathname.startsWith(apiPath)) {
|
||||
if (!token) {
|
||||
return setCorsHeaders(unauthorizedResponse());
|
||||
}
|
||||
|
||||
try {
|
||||
const validationResponse = await fetch(
|
||||
new URL(validationApiRoute, req.url),
|
||||
{
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
if (!validationResponse.ok) {
|
||||
throw new Error('Failed to validate API request');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error validating API request:', error);
|
||||
return setCorsHeaders(unauthorizedResponse());
|
||||
}
|
||||
}
|
||||
|
||||
const response = NextResponse.next();
|
||||
// Ensure token is preserved in cookie
|
||||
if (token) {
|
||||
response.cookies.set(sessionKey, token, {
|
||||
httpOnly: true,
|
||||
secure: process.env.NODE_ENV === 'production',
|
||||
sameSite: 'lax',
|
||||
path: '/'
|
||||
});
|
||||
}
|
||||
return setCorsHeaders(response);
|
||||
};
|
||||
|
||||
function isRoutePublic(pathname: string, publicRoutes: string[], loginPath: string): boolean {
|
||||
return [...publicRoutes, loginPath].some((route) => {
|
||||
const pattern = route.replace(/\*/g, ".*");
|
||||
return new RegExp(`^${pattern}$`).test(pathname);
|
||||
});
|
||||
}
|
||||
|
||||
function getToken(req: NextRequest, sessionKey: string): string | undefined {
|
||||
return req.cookies.get(sessionKey)?.value ||
|
||||
req.headers.get("Authorization")?.split(" ")[1];
|
||||
}
|
||||
|
||||
function unauthorizedResponse(): NextResponse {
|
||||
return new NextResponse(JSON.stringify({ error: "Unauthorized" }), {
|
||||
status: 401,
|
||||
headers: { "Content-Type": "application/json" },
|
||||
});
|
||||
}
|
||||
|
||||
function setCorsHeaders(res: NextResponse): NextResponse {
|
||||
res.headers.set("Access-Control-Allow-Origin", "*");
|
||||
res.headers.set(
|
||||
"Access-Control-Allow-Methods",
|
||||
"GET, POST, PUT, DELETE, OPTIONS"
|
||||
);
|
||||
res.headers.set(
|
||||
"Access-Control-Allow-Headers",
|
||||
"Content-Type, Authorization"
|
||||
);
|
||||
return res;
|
||||
}
|
||||
|
||||
function handleCors(req: NextRequest): NextResponse | null {
|
||||
if (req.method === "OPTIONS") {
|
||||
return new NextResponse(null, {
|
||||
status: 204,
|
||||
headers: {
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
|
||||
"Access-Control-Allow-Headers": "Content-Type, Authorization",
|
||||
"Access-Control-Max-Age": "86400",
|
||||
},
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
async function verifyToken({
|
||||
token,
|
||||
encodedKey,
|
||||
}: {
|
||||
token: string | undefined;
|
||||
encodedKey: string;
|
||||
}): Promise<Record<string, unknown> | null> {
|
||||
if (!token) return null;
|
||||
|
||||
try {
|
||||
const enc = new TextEncoder().encode(encodedKey);
|
||||
const { payload } = await jwtVerify(token, enc, {
|
||||
algorithms: ["HS256"],
|
||||
});
|
||||
return (payload.user as Record<string, any>) || null;
|
||||
} catch (error) {
|
||||
console.error("Token verification failed:", error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: ["/((?!_next|static|favicon.ico|manifest).*)"],
|
||||
};
|
||||
Reference in New Issue
Block a user