Closed steebchen closed 4 months ago
might be a duplicate of #23600
might be a duplicate of #23600
The root cause is hopefully the same (i.e. it all gets fixed if/when https://github.com/prisma/prisma/pull/23754 is merged). But I think tracking this for D1 specifically isn't so bad since the error and stack trace emit different things between the neondb and d1 adapters.
I hoped that the unofficial 5.14.0-integration-static-wasm-worker-loader.5
Prisma version would fix it, but apparently that now gives me a new error
Uncaught ReferenceError: wasm_ba8a497110c853880f9c31c3460be3c21e86d7f4 is not defined
This issue is still under investigation.
I hoped that the unofficial
5.14.0-integration-static-wasm-worker-loader.5
Prisma version would fix it, but apparently that now gives me a new errorUncaught ReferenceError: wasm_ba8a497110c853880f9c31c3460be3c21e86d7f4 is not defined
This issue is still under investigation.
Thanks @jkomyno . I'm looking forward to a resolution for this issue. This is currently blocking me from trying the d1 adapter out for the @cloudflare/next-on-pages
project I am trying to build.
Hey @leedavidcs, perhaps you may try to share your own project as well here, if it's open source? The more context we have on this issue, the better. Thanks!
@jkomyno Sorry, the project is closed source 😕. However, it is currently breaking the documented usage of auth.js v5 while using the Prisma adapter on @cloudflare/next-on-pages. Specifically next.js server actions for signing in.
I'll try to grab some time to create a minimal reproduction using Auth.js v5 and @cloudflare/next-on-pages sometime on or before this weekend.
@jkomyno Sorry for the wait. I've created the repo with a minimal reproduction of the issue I'm facing with Auth.js v5, @prisma/adapter-d1
and @cloudflare/next-on-pages
here: https://github.com/leedavidcs/next-turbo-d1-prisma-error
@leedavidcs I didn't try your code, but one thing I stumbled across came to my mind:
You're using the datasource as described on the documentation on the web:
datasource db {
provider = "sqlite"
url = env("DATABASE_URL")
}
Even though the documentation states the env can be ignored, I had exceptions with it. In the GitHub docs the documentation is actually different, and since changing the configuration it's working for me:
datasource db {
provider = "sqlite"
url = "file:./dev.db"
}
I'm also using next@latest and next-auth@beta. Maybe you're encountering the same issue :)
@nwpr Thanks for the tip. I've updated the url
property on the datasource
and the outcome is unfortunately the same. The repo has been updated to contain the change.
EDIT: Here is the stack trace from when I've last tested the issue (it crashes after the error is thrown):
@project-apps/web:dev: ./src/db/prisma.ts
@project-apps/web:dev: ./src/db/index.ts
@project-apps/web:dev: ./src/server/auth.ts
@project-apps/web:dev: ./src/app/layout.tsx
@project-apps/web:dev: ../../node_modules/.pnpm/next@14.2.3_react-dom@18.3.1_react@18.3.1/node_modules/next/dist/build/webpack/loaders/next-app-loader.js?name=app%2Fpage&page=%2Fpage&appPaths=%2Fpage&pagePath=private-next-app-dir%2Fpage.tsx&appDir=%2Fhome%2Fleedavidcs%2Fprojects%2Fnext-turbo-d1-prisma-error%2Fapps%2Fweb%2Fsrc%2Fapp&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&rootDir=%2Fhome%2Fleedavidcs%2Fprojects%2Fnext-turbo-d1-prisma-error%2Fapps%2Fweb&isDev=true&tsconfigPath=tsconfig.json&basePath=&assetPrefix=&nextConfigOutput=&preferredRegion=&middlewareConfig=e30%3D!./src/app/page.tsx?__next_edge_ssr_entry__
@project-apps/web:dev: ⚠ ../../node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/.prisma/client/wasm-edge-light-loader.js
@project-apps/web:dev: The generated code contains 'async/await' because this module is using "topLevelAwait".
@project-apps/web:dev: However, your target environment does not appear to support 'async/await'.
@project-apps/web:dev: As a result, the code may not run as expected or may cause runtime errors.
@project-apps/web:dev:
@project-apps/web:dev: Import trace for requested module:
@project-apps/web:dev: ../../node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/.prisma/client/wasm-edge-light-loader.js
@project-apps/web:dev: ../../node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/.prisma/client/wasm.js
@project-apps/web:dev: ../../node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/.prisma/client/default.js
@project-apps/web:dev: ../../node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/@prisma/client/default.js
@project-apps/web:dev: ./src/db/prisma.ts
@project-apps/web:dev: ./src/db/index.ts
@project-apps/web:dev: ./src/server/auth.ts
@project-apps/web:dev: ./src/client/components/LoginButton/signIn.ts
@project-apps/web:dev:
@project-apps/web:dev: ../../node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/.prisma/client/wasm-edge-light-loader.js
@project-apps/web:dev: The generated code contains 'async/await' because this module is using "topLevelAwait".
@project-apps/web:dev: However, your target environment does not appear to support 'async/await'.
@project-apps/web:dev: As a result, the code may not run as expected or may cause runtime errors.
@project-apps/web:dev:
@project-apps/web:dev: Import trace for requested module:
@project-apps/web:dev: ../../node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/.prisma/client/wasm-edge-light-loader.js
@project-apps/web:dev: ../../node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/.prisma/client/wasm.js
@project-apps/web:dev: ../../node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/.prisma/client/default.js
@project-apps/web:dev: ../../node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/@prisma/client/default.js
@project-apps/web:dev: ./src/db/prisma.ts
@project-apps/web:dev: ./src/db/index.ts
@project-apps/web:dev: ./src/server/auth.ts
@project-apps/web:dev: ./src/app/layout.tsx
@project-apps/web:dev: ../../node_modules/.pnpm/next@14.2.3_react-dom@18.3.1_react@18.3.1/node_modules/next/dist/build/webpack/loaders/next-app-loader.js?name=app%2Fpage&page=%2Fpage&appPaths=%2Fpage&pagePath=private-next-app-dir%2Fpage.tsx&appDir=%2Fhome%2Fleedavidcs%2Fprojects%2Fnext-turbo-d1-prisma-error%2Fapps%2Fweb%2Fsrc%2Fapp&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&rootDir=%2Fhome%2Fleedavidcs%2Fprojects%2Fnext-turbo-d1-prisma-error%2Fapps%2Fweb&isDev=true&tsconfigPath=tsconfig.json&basePath=&assetPrefix=&nextConfigOutput=&preferredRegion=&middlewareConfig=e30%3D!./src/app/page.tsx?__next_edge_ssr_entry__
@project-apps/web:dev: GET /api/auth/session 200 in 511ms
@project-apps/web:dev: /home/leedavidcs/projects/next-turbo-d1-prisma-error/node_modules/.pnpm/wrangler@3.57.0_@cloudflare+workers-types@4.20240512.0/node_modules/wrangler/wrangler-dist/cli.js:29749
@project-apps/web:dev: throw a;
@project-apps/web:dev: ^
@project-apps/web:dev:
@project-apps/web:dev: SyntaxError: Unexpected identifier 'Promise'
@project-apps/web:dev: at (action-browser)/../../node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/.prisma/client/wasm-edge-light-loader.js (/home/leedavidcs/projects/next-turbo-d1-prisma-error/apps/web/.next/server/app/page.js:4606:1)
@project-apps/web:dev: at __webpack_require__ (/home/leedavidcs/projects/next-turbo-d1-prisma-error/apps/web/.next/server/edge-runtime-webpack.js:37:33)
@project-apps/web:dev: at Function.fn (/home/leedavidcs/projects/next-turbo-d1-prisma-error/apps/web/.next/server/edge-runtime-webpack.js:392:21)
@project-apps/web:dev: at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
@project-apps/web:dev: at async Object.getQueryEngineWasmModule (webpack-internal:///(action-browser)/../../node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/.prisma/client/wasm.js:203:13)
@project-apps/web:dev: at async eval (webpack-internal:///(action-browser)/../../node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/@prisma/client/runtime/wasm.js:11:723)
@project-apps/web:dev: at async Object.loadLibrary (webpack-internal:///(action-browser)/../../node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/@prisma/client/runtime/wasm.js:11:985)
@project-apps/web:dev: at async ft.loadEngine (webpack-internal:///(action-browser)/../../node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/@prisma/client/runtime/wasm.js:11:3277)
@project-apps/web:dev: at async ft.instantiateLibrary (webpack-internal:///(action-browser)/../../node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/@prisma/client/runtime/wasm.js:11:2875)
@project-apps/web:dev:
@project-apps/web:dev: Node.js v20.10.0
@project-apps/web:dev:
I hoped that the unofficial
5.14.0-integration-static-wasm-worker-loader.5
Prisma version would fix it, but apparently that now gives me a new errorUncaught ReferenceError: wasm_ba8a497110c853880f9c31c3460be3c21e86d7f4 is not defined
This issue is still under investigation.
Hey, I'm back at this issue again! @leedavidcs, thanks for your reproduction.
@steebchen, @nwpr, @leedavidcs and others, may you please try this new unofficial version of Prisma? 5.15.0-integration-client-dynamic-wasm-imports.1
You can quickly install it via:
pnpm add -D prisma@5.15.0-integration-client-dynamic-wasm-imports.1;
pnpm update "@prisma/*" 5.15.0-integration-client-dynamic-wasm-imports.1
(please double check that prisma generate
has run before retrying).
Thanks!
I hoped that the unofficial
5.14.0-integration-static-wasm-worker-loader.5
Prisma version would fix it, but apparently that now gives me a new errorUncaught ReferenceError: wasm_ba8a497110c853880f9c31c3460be3c21e86d7f4 is not defined
This issue is still under investigation.
Hey, I'm back at this issue again! @leedavidcs, thanks for your reproduction.
@steebchen, @nwpr, @leedavidcs and others, may you please try this new unofficial version of Prisma?
5.15.0-integration-client-dynamic-wasm-imports.1
You can quickly install it via:
pnpm add -D prisma@5.15.0-integration-client-dynamic-wasm-imports.1; pnpm update "@prisma/*" 5.15.0-integration-client-dynamic-wasm-imports.1
(please double check that
prisma generate
has run before retrying). Thanks!
Thanks @jkomyno ! I'll try the new version either today or tomorrow and let you know.
Hi @leedavidcs, that'd be great, thank you!
Sorry @jkomyno . I haven't been able to validate this because I'm running into an unrelated issue connecting to my local d1 database in the repro repo I've created. I can't invest too much time into verifying this right now as I am traveling. If someone else can verify in my place that would be nice. Else, I will need to get back to you when I've returned from my travels in about 2 weeks.
Thank you for your work on this, and apologies for the inconveniences :pray:
Bug description
There are issues when deploying NextJS (app dir) with CloudFlare pages and D1.
How to reproduce
Reproduction at https://github.com/steebchen/next-cf-prisma-d1
git clone git@github.com:steebchen/next-cf-prisma-d1.git
pnpm install
pnpm dev
When running
pnpm build
, it results in this:Executing a server action results in the following error:
The following warning appears using RSCs in dev mode appears (but it still works!):
Expected behavior
It should work. :D
Prisma information
Environment & setup
Prisma Version