Trying to workaround the Edge Runtime error from deploying on Vercel with MongoDB, Mongoose and Authjs. #11439
Unanswered
mocanuandrei1
asked this question in
Help
Replies: 1 comment
-
Having a similar issue. Bumping this! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
I'm new to this, so I'm hoping to get some help from you all.
I'm facing an issue when trying to deploy my application to Vercel. The error message I receive is: "Dynamic Code Evaluation (e.g., 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime."
After some research, I discovered that Mongoose might be causing this issue since it doesn't support these dynamic code evaluations.
I would appreciate any advice on the best practices to resolve this. I'm unsure if my current approach is correct. I learned that using Prisma instead of Mongoose might be a solution since it supports this environment, but I'm not certain if this is the best route to take.
To give some context about the project, I have several admin pages that I want to protect using middleware. The idea is to redirect logged-in users to the admin pages, giving them access, and redirect non-logged-in users to the login page.
Thank you in advance for your help!
Here is my code :
auth.js
user.js
middleware.js
Beta Was this translation helpful? Give feedback.
All reactions