Skip to content

getSignedUrl in lambda return TypeError: date.getUTCFullYear is not a function

0

Hi, I am using lambda to create signed URL using const signedUrl = await getSignedUrl(s3Client, command, { expiresIn: 3600 });. with, const paramsSignedUrl = { Bucket: bucketName, Key: subfolder, Expires: 60, // URL expiration time in seconds ContentType: body.contentType }; const command = new PutObjectCommand(paramsSignedUrl);

But at getSignedUrl I get TypeError: date.getUTCFullYear is not a function. Please help. Thank you.

asked 2 years ago267 views

1 Answer
0

Hello @manfromtj,

Can you please verify that you are importing the correct version of the AWS SDK for JavaScript before the code that is provided in the question?

For example, if you are using AWS SDK for JavaScript v3, please reference the below:

const { getSignedUrl } = require("@aws-sdk/s3-request-presigner");
const { S3Client, GetObjectCommand } = require("@aws-sdk/client-s3");

Or if you are using AWS SDK for JavaScript v2, please reference the below:

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

If you are able to, please provide the rest of the code and what you are trying to do with the code for further understanding in being able to assist with resolving this error.

And it is recommended that you migrate to AWS SDK for JavaScript v3 as v2's upcoming end-of-support has been announced.

I hope this helps, please let us know if this is resolved. And if it is, please help the community by marking this answer as an “Accepted Answer.”

AWS

answered 2 years ago

EXPERT

reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.