"TypeError","errorMessage":"s3.getSignedUrl is not a function"

0

Enter image description here

I'm writing this lambda function on my AWS console. Can anyone tell me what I'm doing wrong? when I run the test I keep getting the error. "TypeError","errorMessage":"s3.getSignedUrl is not a function"

已提問 6 個月前檢視次數 409 次
2 個答案
0
已接受的答案

Hello.

Is it possible to provide the code directly instead of the image?
Also, could you please share what you are trying to do?

I'm not very good at JavaScript, but I think I need to add the code below.

var AWS = require('aws-sdk');
var s3 = new AWS.S3();

There are other sample codes for obtaining signed URLs, so why not refer to them?
https://docs.aws.amazon.com/AmazonS3/latest/userguide/example_s3_Scenario_PresignedUrl_section.html

profile picture
專家
已回答 6 個月前
profile pictureAWS
專家
已審閱 6 個月前
  • I agree, i changed my nodejs runtime to 14x, it was using 18x that's why I could not use require, but changing it to 14x and using the above code worked for me.

0

This is code for sdk 2.x. As per the this page if you use runtime nodejs18.x it comes with sdk 3.x, which is completely different api.

已回答 6 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南