-
Notifications
You must be signed in to change notification settings - Fork 605
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
[@aws-sdk/client-sns]: custom endpoint.path is not taken into account when making requests #1399
[@aws-sdk/client-sns]: custom endpoint.path is not taken into account when making requests #1399
Comments
Hey @vvo thanks for opening this, I was able to confirm this, V2Code used:var AWS = require('aws-sdk');
const snsClient = new AWS.SNS({
apiVersion: "2010-03-31",
endpoint: "https://example.com/sns"
});
const req = snsClient.publish({
TopicArn: "some:topic",
Message: "hello world",
});
console.log(req.httpRequest) Output:
V3Code used:const {SNS} = require("@aws-sdk/client-sns");
const snsClient = new SNS({
apiVersion: "2010-03-31",
endpoint: "https://example.com/sns"
});
snsClient.middlewareStack.add(next => async (args) => {
console.log("HTTP Request: ", args.request);
}, {
step: "build"
});
snsClient.publish({
TopicArn: "some:topic",
Message: "hello world",
}); Output:
|
The path is generated from the service model, like here, so even we support overriding the hostname for now, we don't support overriding the path. But I can see the value of it. To support this, we need to add a middleware to override the request after the serialization middleware. I put this to the TODO list, will provide more update as we progress. |
Hi, @vvo to provide more information: setting path in the custom endpoint does not always work in v2 SDK. For all REST services except for S3, the path you supplied will be overwritten by the path infered from the service API. Granted, in v3 we can forcely overwrite the path and port if user supplies a custom endpoint. But we could break the users by the some edge cases: If someone supply an endpoint as |
Does a quick workaround exist for the moment? |
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. |
Describe the bug
When using this kind of code:
Then the request is made to
https://example.com/
instead ofhttps://example.com/sns
. I believe because of:aws-sdk-js-v3/clients/client-sns/protocols/Aws_query.ts
Lines 5293 to 5316 in 59948ee
SDK version number v1.0.0-gamma.5
Is the issue in the browser/Node.js/ReactNative?
All
Details of the Node.js version
v12.18.2
To Reproduce (observed behavior)
Steps to reproduce the behavior (please share code or minimal repo)
Expected behavior
Request should be made to https://example.com/sns
Screenshots
n/a
Additional context
The text was updated successfully, but these errors were encountered: