aws / aws-sdk-js-v3

Modularized AWS SDK for JavaScript.
Apache License 2.0
2.96k stars 556 forks source link

S3 v3.540.0 - v3.565.0 breaks when used with s3-request-presigner@v3.565.0 #6045

Closed mattkrick closed 1 month ago

mattkrick commented 2 months ago

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

RanVaknin commented 1 month ago

HI @mattkrick ,

I'm not able to reproduce this issue:

$ npm ls
rvaknin/test_folder/5125
├── @aws-sdk/client-s3@3.569.0
└── @aws-sdk/s3-request-presigner@3.569.0
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~

github-actions[bot] commented 1 month ago

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] commented 4 weeks ago

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.