N
Neon•2y ago
other-emerald

Possible bug when running Prisma + Neon serverless driver from Edge runtime?

Was running into an error when trying to run Prisma with the Neon serverless driver from an edge runtime (using Next.js):
SyntaxError: Unexpected identifier 'Promise'
at (action-browser)/./node_modules/.prisma/client/wasm-edge-light-loader.js
at __webpack_require__
SyntaxError: Unexpected identifier 'Promise'
at (action-browser)/./node_modules/.prisma/client/wasm-edge-light-loader.js
at __webpack_require__
Found a StackOverflow post mentioning the same issue: https://stackoverflow.com/questions/78192413/next-js-application-with-prisma-orm-and-neon-datasource/78213174#78213174 is this a bug or is there smth special we need to consider in the setup?
Stack Overflow
Next.js application with Prisma ORM and Neon Datasource
I am struggling hard to connect to a neon database from a vercel edge function using a prisma client. After searching through the docs, I found out that neon has a serverless driver. I tried to use...
4 Replies
afraid-scarlet
afraid-scarlet•2y ago
This looks suspiciously like a bundling issue. Someone has logged a similar problem with Prisma: https://github.com/prisma/prisma/issues/23600
GitHub
Next.js app build fails when using Prisma with DB driver in Server ...
Bug description When building a Next.js application using Prisma on the edge runtime with the Database driver, the build fails with the following error. This problem seems to occur when using Prism...
other-emerald
other-emeraldOP•2y ago
I see, that does sound like the exact same issue so the issue is probably on the side of Prisma. I've added my error in the GitHub issue as well, all very recent posts so hopefully they will follow it up 🤞 Thanks @ShinyPokemon !
afraid-scarlet
afraid-scarlet•2y ago
You’re welcome, and sorry to hear you’re having trouble deploying your application. Does Prisma 5.10.2 work for you, as the person suggested in the issue?
other-emerald
other-emeraldOP•2y ago
Unfortunately not 😕
⨯ ./node_modules/.prisma/client/query_engine_bg.wasm
Module parse failed: Unexpected character '' (1:0)
The module seem to be a WebAssembly module, but module is not flagged as WebAssembly module for webpack.
BREAKING CHANGE: Since webpack 5 WebAssembly is not enabled by default and flagged as experimental feature.
You need to enable one of the WebAssembly experiments via 'experiments.asyncWebAssembly: true' (based on async modules) or 'experiments.syncWebAssembly: true' (like webpack 4, deprecated).
For files that transpile to WebAssembly, make sure to set the module type in the 'module.rules' section of the config (e. g. 'type: "webassembly/async"').
(Source code omitted for this binary file)

Import trace for requested module:
./node_modules/.prisma/client/query_engine_bg.wasm
./node_modules/.prisma/client/wasm.js
./node_modules/@prisma/client/wasm.js
⨯ ./node_modules/.prisma/client/query_engine_bg.wasm
Module parse failed: Unexpected character '' (1:0)
The module seem to be a WebAssembly module, but module is not flagged as WebAssembly module for webpack.
BREAKING CHANGE: Since webpack 5 WebAssembly is not enabled by default and flagged as experimental feature.
You need to enable one of the WebAssembly experiments via 'experiments.asyncWebAssembly: true' (based on async modules) or 'experiments.syncWebAssembly: true' (like webpack 4, deprecated).
For files that transpile to WebAssembly, make sure to set the module type in the 'module.rules' section of the config (e. g. 'type: "webassembly/async"').
(Source code omitted for this binary file)

Import trace for requested module:
./node_modules/.prisma/client/query_engine_bg.wasm
./node_modules/.prisma/client/wasm.js
./node_modules/@prisma/client/wasm.js
I'll just leave my page out of the edge runtime for now and hopefully Prisma will be able to pick this up

Did you find this page helpful?