question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot find module 'node:http` on AWS Lambda v14

See original GitHub issue

Upgrade from version 3.0 to 3.1 produces a Runtime.ImportModuleError: Error: Cannot find module 'node:http on AWS Lambda runtime.

Screenshots

Screenshot 2021-11-09 at 07 32 57

Your Environment

software version
node-fetch 3.1
node 14

Additional context

Looks like node: prefix for imports added as part of https://github.com/node-fetch/node-fetch/pull/1346 causes this issue. I am happy to submit MR with a revert of this one, but I need to understand the reason why this prefix has been added here on the first place. Can you suport me on this one please @dnalborczyk ?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:16
  • Comments:34 (10 by maintainers)

github_iconTop GitHub Comments

8reactions
berenddeboercommented, Nov 13, 2021

very simple solution for ESBuild have been suggested here

100s of 1000s of programmers will have to Google this error, come here, and apply the patch. That seems to be a colossal waste of time.

And esbuild is often used implicitly. I.e. if you use CDK with the NodeJsFunction, it calls esbuild. People might not even know that happens.

6reactions
dnalborczykcommented, Dec 1, 2021

the latest node.js version on aws is now 14.18.1 and therefore supports the node: prefix for commonjs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Serverless Framework with AWS Lambda error "Cannot find ...
I'm trying to use the Serverless Framework to create a Lambda function that uses open weather NPM module. However ...
Read more >
Resolve the "Unable to import module" error for Lambda code ...
I receive the "Unable to import module" error when I try to run my AWS Lambda code in Node.js. Short description. You typically...
Read more >
Cannot find module (AWS Lambda Error) [Solved] | bobbyhadz
A complete step-by-step guide on how to solve the "Cannot find module" error when trying to load third party packages in AWS lambda....
Read more >
Unable to resolve some modules - node:http [solved]
0 and lock the package version. There is already a GitHub issue on this topic here: Cannot find module 'node:http` on AWS Lambda...
Read more >
serverless-offline - npm
Specifically, Lambda currently runs on Node.js v12.x, v14.x and v16.x (AWS Docs), whereas Offline runs on your own runtime where no memory ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found