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

Setting a custom endpoint of an SNS client results in EndpointError #4076

Closed
3 tasks done
darbio opened this issue Oct 22, 2022 · 11 comments
Closed
3 tasks done

Setting a custom endpoint of an SNS client results in EndpointError #4076

darbio opened this issue Oct 22, 2022 · 11 comments
Assignees
Labels
bug This issue is a bug. closed-for-staleness

Comments

@darbio
Copy link

darbio commented Oct 22, 2022

Checkboxes for prior research

Describe the bug

Setting a custom endpoint of an SNS client results in EndpointError: Endpoint URL must be a string, got object.

SDK version number

@aws-sdk/sns-client@3.194.0

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

v16.18.0

Reproduction Steps

// sns client
let config: SNSClientConfig = {};

if (process.env.IS_OFFLINE) {
    config.endpoint = "http://127.0.0.1:4002";
    config.region = "us-east-1";
}

const client = new SNSClient(config);

console.log(client.config.endpoint);
// Prints:
// [AsyncFunction (anonymous)]

console.log(await client.config.endpoint());
// Prints:
// {
//     hostname: '127.0.0.1',
//     port: 4002,
//     protocol: 'http:',
//     path: '/',
//     query: undefined
//   }

// create the queue
const { TopicArn } = await client.send(new CreateTopicCommand({
    Name: process.env.STACK_SNS_TOPIC_NAME,
    Attributes: {
        DisplayName: "Some Name",
        FifoTopic: "true"
    }
}));

// throws
// EndpointError: Endpoint URL must be a string, got object

Observed Behavior

Throws an EndpointError: Endpoint URL must be a string, got object

Expected Behavior

Client uses custom URL

Possible Solution

No response

Additional Information/Context

No response

@darbio darbio added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 22, 2022
@samuelabreu
Copy link

Same to me trying to use a custom endpoint on CognitoIdentityProviderClient, sticking to 3.171.0 works fine.

@only4lee
Copy link

only4lee commented Oct 23, 2022

bump. I confirm that this also happens with @aws-sdk/client-sqs@3.194.0
When I revert back to 3.171.0 as per @samuelabreu it works fine.

@qmg-rbass
Copy link

Same error for me after updating @aws-sdk/client-cloudwatch 3.193.0 -> 3.194.0

@eau-de-la-seine
Copy link

Hi, I have encountered the same issue with the latest aws-sdk version (3.194.0):

EndpointError: Endpoint URL must be a string, got object

      at getEndpointUrl (node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/getEndpointUrl.js:17:11)
      at evaluateEndpointRule (node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateEndpointRule.js:26:50)
      at evaluateRules (node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateRules.js:11:89)
      at evaluateTreeRule (node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateTreeRule.js:12:46)
      at evaluateRules (node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateRules.js:20:81)
      at evaluateTreeRule (node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateTreeRule.js:12:46)
      at evaluateRules (node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateRules.js:20:81)
      at evaluateTreeRule (node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateTreeRule.js:12:46)
      at evaluateRules (node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateRules.js:20:81)
      at resolveEndpoint (node_modules/@aws-sdk/util-endpoints/dist-cjs/resolveEndpoint.js:26:48)

I think that the issue is global. We init the AWS client, and then there's is internal typing issue when using the methods.

Current solution: sticking to a working version like 3.193.0

@JamesKyburz
Copy link

@eau-de-la-seine I think the issue is global too, I got the same issue with the @aws-sdk/client-eventbridge client@3.194.0, however I had to go back to version 3.190.0 for it to work with a custom endpoint.

@JamesKyburz
Copy link

3.190.0 created some typescript mismatch issues, so sticking with 3.188.0 for now.

@piersatdoshii
Copy link

Hit this issue with dynamodb too, downgraded to 3.193.0 as a workaround.

@kenny-alvizuris-cko
Copy link

I hit the issue today with @aws-sdk/client-sqs version 3.194.0 will post once I get a stable version.

@kuhe kuhe self-assigned this Oct 26, 2022
@kuhe kuhe removed the needs-triage This issue or PR still needs to be triaged. label Oct 26, 2022
@SishaarRao
Copy link

Encountered this issue with @aws-sdk/client-sqs version 3.196.0, downgraded to 3.193.0 and issue went away

@kuhe
Copy link
Contributor

kuhe commented Oct 26, 2022

Thanks for reporting this issue, a fix was included in today's release of version 3.197.0.

@kuhe kuhe added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Oct 27, 2022
@github-actions github-actions bot added closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Oct 31, 2022
@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 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue is a bug. closed-for-staleness
Projects
None yet
Development

No branches or pull requests