Search code examples
amazon-s3aws-sdk

Getting UnexpectedParameter: Unexpected key 'UploadId' found in params' Error in multipart S3 Presigned


I'm getting this error when I add UploadId and PartNumber to my params:

Unexpected key 'UploadId' found in params'
Unexpected key 'PartNumber' found in params'

I'm Using 'aws-sdk' for this reason. and this is my code to get multipart Presigned URL:

 const s3 = new AWS.S3({ endpoint: ep });
 const params = {
        Bucket: myBucket,
        Key: data.key,
        UploadId: data.uploadId,
        PartNumber: data.partNumber,
        Expires: ttl,
    };
 const url = s3.getSignedUrl('putObject', params);

any idea?


Solution

  • I found the problem, just change this line and everything works fine and you get the URL:

    const url = await s3.getSignedUrl('uploadPart', params);
    

    you must use 'uploadPart' instead of 'putObject'

    good luck ;)