Error with imports when trying to upload code to Lambda Function

0

I am working on trying to deploy my code to an aws lambda function via a .zip file and I keep getting the following error when testing:

"errorType": "Error", "errorMessage": "require() of ES Module /var/task/index.js from /var/runtime/index.mjs not supported.\nInstead change the require of index.js in /var/runtime/index.mjs to a dynamic import() which is available in all CommonJS modules.", "trace": [ "Error [ERR_REQUIRE_ESM]: require() of ES Module /var/task/index.js from /var/runtime/index.mjs not supported."

In my package.json I have "type":"module" declared, and I am not using any 'require' imports in any of my files, so I am pretty confused on why this is happening.

If anyone could shed some light on this, that would be great!

Thank you in advance.

질문됨 8달 전483회 조회
1개 답변
0

Hello.

It seems that the package version may be the cause, so you may want to check the package you are using.
https://stackoverflow.com/questions/70541068/instead-change-the-require-of-index-js-to-a-dynamic-import-which-is-available

profile picture
전문가
답변함 8달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠