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

All API requests fail with Cannot find module 'punycode/' #444

Closed
carlgieringer opened this issue Jul 3, 2023 · 0 comments
Closed

All API requests fail with Cannot find module 'punycode/' #444

carlgieringer opened this issue Jul 3, 2023 · 0 comments
Assignees
Labels
bug Broken releasd functionality infrastructure Deployment, monitoring, etc.

Comments

@carlgieringer
Copy link
Contributor

carlgieringer commented Jul 3, 2023

punycode is included in Node but that built-in version has been deprecated since v7 (but still present in v20) (https://nodejs.org/api/punycode.html#punycode_punycode). People import punycode/ to get the installed version and not the built-in Node version (aws/aws-cdk#11099 (comment)).

I'm not sure why this isn't working suddenly. The issue above mentions esbuild not supporting the punycode/ import. Maybe I added something that depends on this import recently, like jsdom?

esbuild appears intentionally to ignore trailing slashes in imports (https://github.com/evanw/esbuild/blob/2703f90d47fd96f425fedcfd2a5c318a43b04d45/internal/resolver/resolver.go#L374-L384) but also appears to consider punycode an internal module (https://github.com/evanw/esbuild/blob/2703f90d47fd96f425fedcfd2a5c318a43b04d45/internal/resolver/resolver.go#L2564C1-L2564C1). So what I think is happening is that esbuild is leaving imports like require("punycode/") in the built code, but when it comes to run-time, Node considers these external modules, and so fails to resolve them.

Someone solved it by including punycode as a Lambda layer (aws/aws-cdk#14290 (comment)).

(Why didn't our API 'smoke test' catch this?)

@carlgieringer carlgieringer added bug Broken releasd functionality infrastructure Deployment, monitoring, etc. labels Jul 3, 2023
@carlgieringer carlgieringer self-assigned this Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Broken releasd functionality infrastructure Deployment, monitoring, etc.
Projects
None yet
Development

No branches or pull requests

1 participant