-
Notifications
You must be signed in to change notification settings - Fork 116
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
Server Side Modules Failing Build (ModuleNotFoundError) #2098
Comments
This issue was discussed on the Discord and posted here.. Tagging @siegerts |
Hi 👋, I'm getting the same behavior in a NextJS project using the The error message is:
|
@NathaEEUD I believe we have the same problem! My issue is opened in #2103 |
Yep, these both appear to be because of this issue. |
@jackHedaya Have you found any alternative solution to solve this issue? (while the issue is fixed) |
Nothing yet, waiting it out until I could find the root of the issue |
Well, what do we do? |
@Athena96 Can you tag this as bug? |
We also ran into this on our project and it's a massive blocker for us. We've tested pretty exhaustively mixing and matching different versions of Webpack, NextJS, Node, etc and nothing is working. Anything you can do to expedite a fix (or provide instructions for a workaround) would be greatly appreciated! |
Hi All, First of all, thanks for raising and providing details both here and on Discord. Apologies if this a blocker - The team is looking into this. If your environment/project setup is different than @RealDrewKlayman's repro example above (or linked issues), please add here. Specifics to include are the combination of:
|
Hi @RealDrewKlayman , sorry you are facing this. We have identified an issue with how we bundle modules with newer versions of webpack5 and Next.js for the server side lambdas. We are working on a resolution and will follow up here when we have an update. |
Thank you for keeping me in the loop. My team was just asking if I had an update so I really appreciate this... Is there a workaround I can put in my app in the meantime? |
We wouldn't be able to differ from Argon2 because in the project we are using it in, it has to verify an Argon2 hash so I'll look into those articles you sent. |
Having the same issue here. My set up is the same as @NathaEEUD
Like I mentioned before, I am also using NextAuth v3.27.3. |
We're also seeing this happen at App ID |
I'm having the same problem. I got errors that it couldn't find libraries. First it was: @sls-next/serverless-undefined. Which I solved using a different Amplify Cli version. Then it gave me errors on:
I tried added them to package.json. But then eventually it couldn't find webpack. Currently is is failing on dependency: sass. I do use SASS, but Next exports the application fine. I am using:
|
@Athena96 Any update on this? It's still a big blocker.. |
My work-around which isn't really a work-around: |
Any updates on this? Our workaround, just so we could keep developing, was to remove nextauth completely. Not really an option for production at which time we're hoping this is resolved. Otherwise we need to find an alternative to Amplify. |
Our team sent an email to Amplify asking if for an update and we got a reply from @Athena96 yesterday saying:
We are all kind of just stuck until this issue is fixed. We are hoping a fix is implemented soon so that we can get it in before this code reaches production as well... I really hope that there is not actually an additional issue with using Argon2 with Amplify because I didn't understand that whole custom image thing. |
We are facing the same issue with Sentry on Next.js 11 with Webpack 5. |
Hi everyone, we are adding support for deploying NextJS apps with the In the interest of being extra careful and preserving backwards compatibility, we are not going to make this the default target yet. So for those having webpack issues, you will need to opt-in into this feature by specifying the target in your module.exports = {
target: 'experimental-serverless-trace'
} Important Note As of today (Oct 11, 2021) this has not been rolled out to production yet. We plan to start rolling out very soon. Stay tuned. We will provide an update when it is GA. |
Thank you. We'll give that a try when it is rolled out. |
Hi @ferdingler. I really appreciate your work on this! I just wanted to ask, if you could specify "very soon" a little bit more 😄 Does this happen next week or rather next month? |
Hi @gopeter, unfortunately we can't provide specific ETAs. But what I meant by very soon is that the release is already in the pipeline and it's just a matter of time before it rolls out to all regions. If you want to give it a try today, try in the |
Great, thanks a lot! |
Hi all, we have rolled this out to all regions. Feel free to give it a try by specifying the following target in your module.exports = {
target: 'experimental-serverless-trace'
} I will leave this ticket open if you want to report back your experience here. |
Hi @ferdingler! I just tried with: target: 'experimental-serverless-trace' but still same issue with Sentry. Next.js 11 |
@ovdahlberg can I have your appId? I would like to look at the build logs just to confirm you are being opt-in properly. |
@ferdingler Yes, of course! Here it is: d86vdq4sozpmj. You can take a look at pr-69. I did multiple tries on that branch. |
@ovdahlberg thank you. I see what's happening, we are failing to load your |
I can confirm that this fixed the issue for us. |
@ferdingler Thank you for looking into this! It's the way Sentry is installed in Next.js, you can see their documentation here: https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/ |
Is there any documentation on which regions are already supported for |
@tomploem It's available in all regions now. But I am just learning that it may not work if your We will work on a fix for this. In the meantime, if you feel adventurous, I tried the latest canary release of v11 ( As a side note, NextJS announced yesterday that they will be deprecating the Quote from their site:
The good news is that apparently these issues will be finally solved in v12 (which we don't support yet, but stay tuned). And in the meantime, we will work on a fix for the |
We are running into the same issue with Sentry. @ferdingler any updates yet on the fix? @ovdahlberg did you happen to find a workaround for this? |
@ferdingler This issue has started re-occuring yet without any configuration changes. UPDATE:I was told that they actually reverted the ability to use the target for |
@RealDrewKlayman |
Same issue with next-auth
|
Any update on these? I'm just starting to add sentry to NextJS and hosting it to amplify and it crashed. Saying Module not found for serveral modules like webpack, any help? |
I am also facing the same issue using next-auth, I have tried to resolve using webpack 4, but unfortunately need webpack 5 for my app to work. Has there been any updates on this? |
Also experiencing this with Sentry/Webpack5. |
We have since launched improved support for Next.js versions 12 and 13 so this should no longer be an issue. Marking this as resolved. |
|
This issue has been automatically locked. |
Before opening, please confirm:
App Id
d22wer5oad5zkl
Region
us-east-2
Amplify Console feature
Other - SSR Building (Webpack)
Describe the bug
argon2
Build fails with message:
Expected behavior
It should ignore that module since it is a server side module.
The build should not fail (more information in Additional Information section)
Reproduction steps
To skip all these steps you can just clone this repository: https://github.com/RealDrewKlayman/nextjs-amplify-import-error
npx create-next-app --typescript
.pages
andstyles
into a new folder calledsrc
.npm install argon2
.src/pages/api/hello.ts
file to this:(This is just a simple API route I made using that module)
5. Push/Deploy to Amplify
Build Settings
Additional information
https://arunoda.me/blog/ssr-and-server-only-modules
That's an old article explaining why these modules should not be included in the build. It's old so it claims that NextJS doesn't know how to handle this but Vercel and local builds handle it perfectly.
A workaround is to add all these modules in ignorePlugin in Webpack which is not ideal at all.
The text was updated successfully, but these errors were encountered: