aws-sdk-js-v3 icon indicating copy to clipboard operation
aws-sdk-js-v3 copied to clipboard

S3 v3.540.0 - v3.565.0 breaks when used with [email protected]

Open mattkrick opened this issue 1 year ago • 2 comments
trafficstars

Checkboxes for prior research

Describe the bug

Unable to presign a URL using an S3 client that is at v3.540.0 or newer

SDK version number

@aws-sdk/client-s3@^3.540.0

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

v20.11.0

Reproduction Steps

const client = new S3Client({
      region: 'us-east-1',
      bucketEndpoint: true
    })
const command = new GetObjectCommand({Bucket: this.baseUrl, Key: key})
const encodedUri = await getSignedUrl(client, command, {expiresIn: 3600})

Observed Behavior

TypeError: Cannot read properties of undefined (reading 'parseArn')
at callFunction (/node_modules/@smithy/util-endpoints/dist-cjs/index.js:269:50)
at evaluateCondition (/node_modules/@smithy/util-endpoints/dist-cjs/index.js:280:17)
at evaluateConditions (/node_modules/@smithy/util-endpoints/dist-cjs/index.js:293:34)
at evaluateErrorRule (/node_modules/@smithy/util-endpoints/dist-cjs/index.js:397:39)
at evaluateRules (/node_modules/@smithy/util-endpoints/dist-cjs/index.js:431:7)
at evaluateTreeRule (/node_modules/@smithy/util-endpoints/dist-cjs/index.js:416:10)
at evaluateRules (/node_modules/@smithy/util-endpoints/dist-cjs/index.js:433:35)
at evaluateTreeRule (/node_modules/@smithy/util-endpoints/dist-cjs/index.js:416:10)
at evaluateRules (/node_modules/@smithy/util-endpoints/dist-cjs/index.js:433:35)
at resolveEndpoint (/node_modules/@smithy/util-endpoints/dist-cjs/index.js:462:20)

Expected Behavior

No error

Possible Solution

No response

Additional Information/Context

No response

mattkrick avatar May 01 '24 18:05 mattkrick

HI @mattkrick ,

I'm not able to reproduce this issue:

$ npm ls
rvaknin/test_folder/5125
├── @aws-sdk/[email protected]
└── @aws-sdk/[email protected]
import { S3Client, GetObjectCommand } from '@aws-sdk/client-s3'
import { getSignedUrl } from '@aws-sdk/s3-request-presigner'

const s3Client = new S3Client({
    region:"us-east-1",
    bucketEndpoint: true
});

const url = await getSignedUrl(s3Client, new GetObjectCommand({
    Bucket: 'https://your-bucket-name.s3.amazonaws.com',
    Key: 'foo.txt',
}), { expiresIn: 3600 });

console.log(url);

/*
prints:

https://your-bucket-name.s3.amazonaws.com/foo.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=REDACTED%2F20240507%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240507T190255Z&X-Amz-Expires=3600&X-Amz-Signature=REDACTED&X-Amz-SignedHeaders=host&x-id=GetObject

*/

Did you update the rest of the SDK's dependencies to all be on @latest?

Thanks, Ran~

RanVaknin avatar May 07 '24 19:05 RanVaknin

This issue has not received a response in 1 week. If you still think there is a problem, please leave a comment to avoid the issue from automatically closing.

github-actions[bot] avatar May 18 '24 00:05 github-actions[bot]

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

github-actions[bot] avatar Jun 06 '24 00:06 github-actions[bot]