-
Notifications
You must be signed in to change notification settings - Fork 86
Webpack5 Errors with Serverless Mode in Next + Next-Auth + Netlify-Plugin-Nextjs #527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi. The Essential Next.js plugin requires a serverless target because that's how it deploys the routes to Netlify functions. The other features are then implemented in our wrapper functions. Can you try using |
I can absolutely experiment with that later tdoay @ascorbic ! Do you happen to know what the differences are between |
@bcnichols3 when using |
I greatly appreciate the extra color here. The true problem here is the lack of clarity on what's actually failing and why — and since this is caused by several techs interconnecting, obviously it's not an easy problem for just the I will dig into e-s-t mode when I can and report back. With luck that'll solve my issue. Edit: I'll also point out i dont believe this has to do with |
yeah, i hear you :/ do let us know about e-s-t. it's possible also adding |
Hi, I was having the exact same issue and can confirm that setting the |
@tbooth-prog thanks for letting us know! 🙏 we'll keep open for a little til we hear from @bcnichols3. hopefully e-s-t solves their issue as well, but it may be a greater issue if their overall request is to opt out of serverless. |
@lindsaylevine e-s-t has cleared the webpack error! I'm getting a db connection timeout error ATM -- but that may be (A) my screw-up or (B) a separate issue :) |
@bcnichols3 oh no! i'll go ahead and close this one, but if you find you can't resolve your db connection timeout, please feel free to open a new issue! we used to have |
Describe the bug
I'm running Next 11 and @netlify/plugin-nextjs 3.6.3 and seeing this message in the
onPreBuild
step when I deploy:The "target" config property must be one of "serverless", "experimental-serverless-trace". Building with "serverless" target.
However the next.js team recommends you not use serverless. The results is a webpack 5 error that seems to be related to next-auth: it depends on TypeORM internally, which has a few dynamic optional imports that are used depending on the DB you hook TypeORM up to. Even when they're not being used, and should be shook, Webpack is unable to find those dependencies and you'll get errors like this:
ModuleNotFoundError: Module not found: Error: Can't resolve 'mongodb' in '/opt/build/repo/node_modules/typeorm/platform'
Netlify blocks me from building if it demands I use
serverless
. The only way I've been able to build locally using Next11 and Next-Auth is without a specifiedtarget
in mynext.config.js
. Is there a way to tell the Netlify next plugin not to turn ontarget: serverless
?To Reproduce
Steps to reproduce the behavior:
Expected behavior
Next is able to complete a build that Netlify can deploy.
Versions
Next.js: 11.0.0
next-auth: 3.27.1
netlify plugin: first no install, then 3.6.3
netlify.toml:
The text was updated successfully, but these errors were encountered: