-1

I'm recently migrating from node v14 to v18 which requires AWS SDK v2 upgrade to v3. node v14 to v18

This is how the implementation went

const s3 = new S3Client({ signatureVersion: 'v4' });
 try {
    let command = new PutObjectCommand(params);
    if (flag === 'DOWN') {
      command = new GetObjectCommand({
        Bucket: params.Bucket,
        Key: params.Key,
      });
      delete params.Metadata;
      logger.info({
        reqp: { headers: { rid } },
        message: `Command invoked is ${command.constructor.name}`,
      });
const url = await getSignedUrl(s3, command);

I think there is some issue with how I'm passing params in getSignedUrl function. Please help.

1 Answers1

0

I got the same error. It's because they changed the Expires property in the command object to expect a Date. If you just want to send in the same number of seconds as before, remove it from the command and send it in a configuration object to the getSignedUrl function

The answer in this post shows an example. How do I use the javascript aws-sdk v3 (or backblaze native apis) to create a signed url to use on the client to upload (put) files to the bucket?

Mark
  • 18
  • 2