Skip to content
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

Error building with cloudflare, vercel-edge or netlify-edge presets #378

Closed
maoosi opened this issue Jul 29, 2022 · 5 comments · Fixed by #388
Closed

Error building with cloudflare, vercel-edge or netlify-edge presets #378

maoosi opened this issue Jul 29, 2022 · 5 comments · Fixed by #388
Assignees
Labels
bug Something isn't working

Comments

@maoosi
Copy link

maoosi commented Jul 29, 2022

Environment

  • Node.js v16.14.2
  • Nuxt 3.0.0-rc.6
  • Nitropack 0.4.12

Reproduction

Click here to access reproduction on Stackblitz, then run the below command:

# working as expected
npm run build

# build errors
NITRO_PRESET=cloudflare npm run build
NITRO_PRESET=vercel-edge npm run build
NITRO_PRESET=netlify-edge npm run build

Describe the bug

Nuxt3 build is failing when running with edge-related presets such as:

  • NITRO_PRESET=cloudflare
  • NITRO_PRESET=vercel-edge
  • NITRO_PRESET=netlify-edge

Additional context

Probably related to:

Logs

Example logs when using NITRO_PRESET=cloudflare:

ERROR  Rollup error: Cannot resolve "/home/projects/nitro-preset-cloudflare-issue/node_modules/unenv/runtime/node/stream/index/web.cjs" from "/home/projects/nitro-preset-cloudflare-issue/node_modules/cross-undici-fetch/dist/create-node-ponyfill.js" and externals are not allowed!

ERROR  Cannot resolve "/home/projects/nitro-preset-cloudflare-issue/node_modules/unenv/runtime/node/stream/index/web.cjs" from "/home/projects/nitro-preset-cloudflare-issue/node_modules/cross-undici-fetch/dist/create-node-ponyfill.js" and externals are not allowed!
@warflash
Copy link

#293 is probably also be related. Seems like unfortunately the cloudflare preset is pretty dead at the moment

@maoosi maoosi changed the title Error building with NITRO_PRESET=cloudflare Error building with NITRO_PRESET=cloudflare or NITRO_PRESET=vercel-edge Jul 30, 2022
@maoosi maoosi changed the title Error building with NITRO_PRESET=cloudflare or NITRO_PRESET=vercel-edge Error building with cloudflare or vercel-edge presets Jul 30, 2022
@maoosi
Copy link
Author

maoosi commented Jul 30, 2022

I've edited my initial post to include #293. I also noticed the same issue with NITRO_PRESET=vercel-edge, so this issue is probably affecting all edge-related presets.

@maoosi maoosi changed the title Error building with cloudflare or vercel-edge presets Error building with cloudflare, vercel-edge or netlify-edge presets Jul 30, 2022
@danielroe danielroe added the bug Something isn't working label Aug 5, 2022
@danielroe danielroe self-assigned this Aug 5, 2022
@pi0 pi0 closed this as completed in #388 Aug 5, 2022
@warflash
Copy link

warflash commented Aug 10, 2022

@maoosi Did you get a chance to verify the fix yet? I just updated my bridge app to nitro 0.4.18 and am still running into the same rollup externals not allowed error on edge presets. Wondering if I'm experiencing something unrelated or if the error still persists


For reference, this is the failing import part.
https://github.com/uber-web/probe.gl/blob/master/modules/log/src/node/node-asciify-image.ts
I suspect the try catch around the require might be throwing something off and due to edge targets not supporting the node runtime it crashes
@danielroe

@danielroe
Copy link
Member

The original reproduction (linked above) is now succeeding: https://stackblitz.com/edit/nitro-preset-cloudflare-issue-yxjhpg. I can't speak to your project @warflash but you are welcome to open a new issue with a reproduction and I'll be very happy to look into it.

@warflash
Copy link

Oh right, I missed the repro link, sorry about that. Opened #410, thanks for taking a look! 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants