Need help deploying with vercel
Unanswered
Canada Warbler posted this in #help-forum
Canada WarblerOP
Im trying to deploy with vercel but the deployment fails, Ive never deployed anything before so I dont know exactly where I messed up with the deployment
21 Replies
Yellow-bellied Flycatcher
Post deployment error pics so I can try help.
Canada WarblerOP
Yellow-bellied Flycatcher
Your auth file is the issue and one of your dependencies, share auth file if possible and package json.
Canada WarblerOP
auth ts file
dependencies
Yellow-bellied Flycatcher
Bycrypt module is the cause from the errors given the it's not able to run on edge runtime for some reason and as you're using it in auth ts file.
Canada WarblerOP
I kinda guessed but I dont know how to fix it
See if you can configure this on your next config file:
And then in your middleware.ts file:
EDIT: Apparently this will throw an error if you’re not in the next@canary version of Next.js, because it’s not production ready yet.
const nextConfig: NextConfig = {
experimental: {
nodeMiddleware: true,
},
}
And then in your middleware.ts file:
export const config = {
runtime: 'nodejs',
};
EDIT: Apparently this will throw an error if you’re not in the next@canary version of Next.js, because it’s not production ready yet.
Middleware in Next.js uses the Edge runtime, not the Node.js runtime. Which means native Node.js APIs or Libraries who depend on native Node.js APIs aren’t supported. Apparently bycryptjs is one of them… your errors report that the library is using Node.js APIs (crypto, setImmediate, process.NextTick)
You can maybe look for a different way to compare your password that doesn’t make use of Node APIs.
You can maybe look for a different way to compare your password that doesn’t make use of Node APIs.
Canada WarblerOP
Okay 👍
@Canada Warbler solved?
Canada WarblerOP
yeah but Ive been running into a cors issue
its deployed butit dint display any info and then I realized I didnt prep it for production and Im just confused on what to do
I changed the fetch request to the web url and appropriate endpoints but then i get this error
I've never run into CORS issues in Next.js so maybe [this article](https://blog.logrocket.com/using-cors-next-js-handle-cross-origin-requests/) is helpful for you. Handles CORS in Next.js app router in different ways and depending on different scenarios, including middleware.
Canada WarblerOP
Thank you ill check it out
@LuisLl I've never run into CORS issues in Next.js so maybe [this article](<https://blog.logrocket.com/using-cors-next-js-handle-cross-origin-requests/>) is helpful for you. Handles CORS in Next.js app router in different ways and depending on different scenarios, including middleware.
Canada WarblerOP
Thank you, I was able to fix it by adding the headers from the article
thank you so much🙏
Of course! Happy to help;)