[FEATURE] - Support Edge runtime
Summary
CloudFlare only supports edge runtime, so it would be nice to support it.
Adding export const runtime = 'edge' throws this error:
./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_o5vmxd7xi4lgsgrvif33n2qymu/node_modules/@premieroctet/next-admin/dist/hooks/useRouterInternal.js:4:0
Module not found: Can't resolve 'querystring'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_o5vmxd7xi4lgsgrvif33n2qymu/node_modules/@premieroctet/next-admin/dist/components/Dashboard.js
Basic Example
export const runtime = 'edge'
Drawbacks
No response
Unresolved questions
No response
Hi, we have removed some non-edge-compliant code in v4.2.1 🚀
Let us know if you faced any others issues
Hi @cregourd , thanks for the quick help! Here are the errors left in 4.2.1:
./node_modules/.pnpm/@[email protected][email protected]/node_modules/@prisma/client/runtime/library.js:1:2792
Module not found: Can't resolve 'os'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_oq2ngw3r5xqc4ixcfbt5wejqye/node_modules/@premieroctet/next-admin/dist/actions/form.js
./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_oq2ngw3r5xqc4ixcfbt5wejqye/node_modules/@premieroctet/next-admin/dist/actions/index.js
./src/app/(dynamic)/(main)/studio/admin/[[...nextadmin]]/actions.ts
./src/app/(dynamic)/(main)/studio/admin/[[...nextadmin]]/page.tsx
As well for path, fs, child_process, fs/promises.
It looks like importing from @prisma/client/runtime/library is the fault here.
import {
PrismaClientKnownRequestError,
PrismaClientValidationError,
} from "@prisma/client/runtime/library"
After a thorough review of edge support, I regret to inform you that it is currently not possible to implement it.
Next-admin uses Prisma.DMMF to work, but Prisma.DMMF is not available on edge runtimes - issue
The only way to get it to work would be to create a custom Prisma generator to get all the information we need from the model and replace prisma-json-schema-generator with it. However, this is not currently a planned task and will be tedious.
If you have another idea to solve this problem, please let us know. And feel free to submit other alternatives 🙂
This is indeed a Prisma issue, let's wait they fix it. Thanks again for the quick support.
Closing this while its not supported by Prisma