Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect hostname for accesspoint when useDualstackEndpoint is enabled #3002

Closed
trivikr opened this issue Nov 8, 2021 · 2 comments · Fixed by #3003
Closed

Incorrect hostname for accesspoint when useDualstackEndpoint is enabled #3002

trivikr opened this issue Nov 8, 2021 · 2 comments · Fixed by #3003
Labels
bug This issue is a bug.

Comments

@trivikr
Copy link
Member

trivikr commented Nov 8, 2021

Describe the bug

The SDK sets incorrect hostname for Bucket containing accesspoint ARN when useDualstackEndpoint is enabled

Your environment

SDK version number

@aws-sdk/client-s3@3.40.0

Is the issue in the browser/Node.js/ReactNative?

N/A

Details of the browser/Node.js/ReactNative version

$ node -v
v16.13.0

Steps to reproduce

Code
import { S3 } from "@aws-sdk/client-s3";

const region = "us-west-2";
const useDualstackEndpoint = true;

// ARN for the accesspoint
const Bucket =
  "arn:aws:s3:us-west-2:123456789012:accesspoint/trivikr-accesspoint-testing";

const client = new S3({ region, useDualstackEndpoint });
await client.listObjects({ Bucket });

Observed behavior

throws getaddrinfo ENOTFOUND error.

Example output
node:internal/process/esm_loader:94
    internalBinding('errors').triggerUncaughtException(
                              ^

Error: getaddrinfo ENOTFOUND trivikr-accesspoint-testing-123456789012.s3-accesspoint.dualstack.us-west-2.us-west-2.amazonaws.com
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'trivikr-accesspoint-testing-123456789012.s3-accesspoint.dualstack.us-west-2.us-west-2.amazonaws.com',
  '$metadata': { attempts: 1, totalRetryDelay: 0 }
}

Expected behavior

Sets correct hostname for Bucket containing accesspoint ARN when useDualstackEndpoint is enabled.

Additional context

Probably related to #3001

@trivikr trivikr added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. and removed needs-triage This issue or PR still needs to be triaged. labels Nov 8, 2021
@trivikr
Copy link
Member Author

trivikr commented Nov 8, 2021

For the example provided in the bug, the hostname is

trivikr-accesspoint-testing-123456789012.s3-accesspoint.dualstack.us-west-2.us-west-2.amazonaws.com

It should be:

trivikr-accesspoint-testing-123456789012.s3-accesspoint.dualstack.us-west-2.amazonaws.com

Equivalent AWS CLI code:

$ aws --version
aws-cli/2.2.12 Python/3.8.8 Darwin/20.6.0 exe/x86_64 prompt/off

$ aws configure set default.s3.use_dualstack_endpoint true

$ aws s3api list-objects --bucket arn:aws:s3:us-west-2:123456789012:accesspoint/trivikr-accesspoint-testing --debug 2>&1 | grep "urllib3.connectionpool"
2021-11-08 18:02:01,865 - MainThread - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): trivikr-accesspoint-testing-123456789012.s3-accesspoint.us-west-2.amazonaws.com:443
2021-11-08 18:02:01,915 - MainThread - urllib3.connectionpool - DEBUG - https://trivikr-accesspoint-testing-123456789012.s3-accesspoint.us-west-2.amazonaws.com:443 "GET /?encoding-type=url HTTP/1.1" 200 None

@github-actions
Copy link

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 github-actions bot locked as resolved and limited conversation to collaborators Nov 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue is a bug.
Projects
None yet
1 participant