SAM local invoke with NodeJS AWS SDK V3

0

Hi there, I am getting started using the SAM tools, and everything works well until I add any v3 aws sdk packages to my project. At which time when I call sam local invoke, I receive a function timeout error. Has anyone else run into this? I am using the basic Hello World template for NodeJS 16. I can run sam local invoke after the project is built without error. I then run the following commands:

cd hello-world

npm install @aws-sdk/client-secrets-manager --save

I then add the following line to the top of app.js

const { SecretsManagerClient, CancelRotateSecretCommand } = require("@aws-sdk/client-secrets-manager");

And then I run sam local invoke again and receive an error.

Is there a way to get SAM local to work with v3 Javascript SDKs?

질문됨 일 년 전583회 조회
1개 답변
0
수락된 답변

Hi,

Does the lambda function work when invoked on console? Could you try node18 so you don’t need to install sdk v3 explicitly?

Let me know

profile picture
전문가
답변함 일 년 전
  • Thanks so much for the response. I upgraded to node 18 which in fact did work when I did not npm install the sdk. However, if I do npm install the sdk, then it fails. I don't believe this will cause any issues, but I found it curious. Could you enlighten me on the reason for that, please?

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

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

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

관련 콘텐츠