-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Netlify Build Failing #12764
Comments
@fanckush See if you can set |
@danielroe thanks for the quick reply, the ENV is working as I see the following log: but the error is the same in both cases |
Then I think this should be raised upstream with Netlify as it's happening not within the Nuxt build step but within packaging functions. cc: @ascorbic |
Thanks! interestingly, in the logs Netlify says:
this makes it seem like it's on my end to add something |
@fanckush My reading of the error message is that the script bundling the functions is expecting |
Hey. This certainly seems to be a bundling issue. The |
There's a related thread on Netlify Forums: https://answers.netlify.com/t/deploying-a-new-nuxt-3-app-result-to-error/47029 |
This seems like a regression related to a change I introduced into Netlify's bundling process. Looking into it! |
I was able to reproduce & fix this in netlify/zip-it-and-ship-it#802 🥳 Will ping here once it's deployed. |
Thanks for fix @netlify-team-account-1 <3 I'm wondering why netlify has to re-bundle nitro functions that are already made for Nelify? It is because you expect a CommonJS entrypoint? /cc @ascorbic |
Correct. AWS lambda doesn't support ESM, so we need to transpile it all. If Nitro can generate a node 14 -compatible cjs bundle then it could run it unchanged |
I was kinda assuming Netlify does dark magic for supporting ESM with lambda till today 😆 But of course we can update netlify preset to emit CJS (or CJS entry). We need it for generic AWS support anyway. BTW may I ask how it works? If the function is using |
I think it just might be possible to emit the right kind of entrypoint (while keeping the rest of the lambda ESM). There are some examples out there of people who've done the same with AWS Lambda, e.g. here. |
Environment
Describe the bugReproductionhttps://github.com/productdevbook/nuxt3-app Additional contextNo response LogsNo response |
@pi0 That does sound like the simplest solution. Changing it to .js should just work: it will switch back to the default bundler, which doesn't compile anything. I made the entrypoint |
@danielroe Would this give any benefit aside from consistency in compiling most targets to ESM? |
Yes! Most importantly for dealing with |
I have the same right now, I'll use Vercel until this issue is resolved. |
@florian-lefebvre Did you just deploy that? The fix should have been live for a while now but it will need to be a new deploy before it will work. |
It still doesn't work. I just deployed it, here is the link https://youthful-gates-3fd198.netlify.app/. |
I confirm same problem here. Had the same error as the original post and now getting same error as florian-lefebvre on my site https://stoic-fermat-995d10.netlify.app/ |
Importing Node modules with the |
So after the fix from @netlify-team-account-1 the deploy was succeeding! 🎉
Setting the following AWS ENV did not solve the issue (still getting the same runtime error): EDIT: I've rebuild but forgot to mention in the original message |
Updated env vars only go into effect on new deploys, did you redeploy your site? |
@netlify-team-account-1 just tried to re-deploy my site with these envs, still same error {
"errorType": "Runtime.ImportModuleError",
"errorMessage": "Error: Cannot find module 'node:http'\nRequire stack:\n- /var/task/.netlify/functions-internal/server/server.js\n- /var/task/server.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
"trace": [
"Runtime.ImportModuleError: Error: Cannot find module 'node:http'",
"Require stack:",
"- /var/task/.netlify/functions-internal/server/server.js",
"- /var/task/server.js",
"- /var/runtime/UserFunction.js",
"- /var/runtime/index.js",
" at _loadUserApp (/var/runtime/UserFunction.js:100:13)",
" at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)",
" at Object.<anonymous> (/var/runtime/index.js:43:30)",
" at Module._compile (internal/modules/cjs/loader.js:1072:14)",
" at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)",
" at Module.load (internal/modules/cjs/loader.js:937:32)",
" at Function.Module._load (internal/modules/cjs/loader.js:778:12)",
" at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)",
" at internal/main/run_main_module.js:17:47"
]
} |
Thanks. That is very strange. We'll be looking into it today. |
It seems the frustrating answer is that the AWS Lambda runtime is currently on Node v14.17.4, while |
It's node-fetch that's the problem: they claim to support Node 12, but in the latest release changed all the imports to use the prefix. I'm going to open an issue. |
OK, there already is an issue covering it: node-fetch/node-fetch#1367 |
Separately, @danielroe: I've confirmed that this should work for us too, and would mean it woudln't be re-bundled. |
And, of course, should work for the regular lambda preset too |
I deployed netlify/zip-it-and-ship-it#806 to production. The issue should not occur anymore. If it does, please let me know :) |
fixed thank you |
Fixed ! |
Works great!! The Manual ENV vars are not needed either! I was able to get it working out-of-the-box |
Environment
Darwin
v14.18.1
0.0.0
yarn@1.22.10
Webpack
-
-
-
Describe the bug
Am I doing something wrong?
Netlify Deploy is failing
Reproduction
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: