-
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
v3.192.0: breaking change - client.config.endpoint() is no longer automatically set #4122
Comments
Please update your My code: import { S3Client } from '@aws-sdk/client-s3';
const s3 = new S3Client({
region: 'us-east-1',
endpoint: "localhost://myendpoint.com"
});
const endpoint = await s3.config.endpoint()
console.log(endpoint) Result: {
hostname: 'myendpoint.com',
port: undefined,
protocol: 'localhost:',
path: '',
query: undefined
} Let me know if this helps. |
Still the same error. One thing to note, I have not defined the const s3 = new S3Client({
region: 'us-east-1'
});
const endpoint = await s3.config.endpoint() |
Hi @thetutlage , Thanks for the follow information. I can confirm that this behavior changed, as running this in Repro code: //node v18.0.0
import { S3Client } from '@aws-sdk/client-s3';
const s3 = new S3Client({region: "us-east-1"})
await s3.config.endpoint() Error: await s3.config.endpoint()
^
TypeError: s3.config.endpoint is not a function
at 4122_endpoint_error/sample.js:5:17
at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:409:24)
at async loadESM (node:internal/process/esm_loader:85:5)
at async handleMainPromise (node:internal/modules/run_main:61:12)
Node.js v18.0.0 dependencies: $ npm list
4122_endpoint_error
└── @aws-sdk/client-s3@3.200.0
$ npm list -all
<entire tree structure redacted>
@aws-sdk/util-endpoints@3.200.0
@aws-sdk/middleware-stack@3.200.0
(and all other middleware modules are 3.200.0) Assigning to the dev team for further investigation. Thanks, |
All AWS SDKs have recently updated their endpoint implementations. Here in the AWS SDK for JavaScript v3, the To resolve a service endpoint without calling an API operation, you can reference this example. Both a client and a command are needed, because the endpoint may now vary depending on the parameters of both, and which command is being used. const { S3Client, PutObjectCommand } = require("@aws-sdk/client-s3");
const { getEndpointFromInstructions } = require("@aws-sdk/middleware-endpoint");
(async () => {
// 1. a service client
const client = new S3Client({});
// 2. a command
const command = new PutObjectCommand({
Key: "__key__",
Bucket: "__bucket__",
});
const endpoint = await getEndpointFromInstructions(command.input, PutObjectCommand, client.config);
console.log(endpoint);
})(); output:
|
@kuhe So what you are telling me is?
|
I'm with @thetutlage. I'm going to voice my frustrations with this project recently. It no longer follow semantic versioning. As an agent developer for New Relic, these updates have been very disruptive. We do not know how to handle this package going forward. We don't want to lock down only instrumenting to a specific version but there's been a rash of breakages that are forcing our hand. |
I'm still unsure why the bug label has been removed here. At the very least the typescript typings need updated |
These packages aren't semantically versioned.
|
Is there any specific reason for removing this method in first place? |
To share more context. I was relying on this method to generate the URLs for an object inside the bucket. Is there an alternate API that can return the URL of an object, especially when the config does not have endpoint configured |
@kuhe it would be super helpful if this was called out at the top of the README. It's very unusual for npm packages, especially from such a reputable company as AWS, to create open source packages and not adhere to semantic versioning. |
@thetutlage I think @kuhe provided a solution here, did that work for you? |
@bizob2828 Nope, if I use the following code, then TypeScript complains for types mis-match. Their SDKs do not have any docs, its just auto generated methods signature, so I have no idea how to approach creating URLs in practice. Even if I stumble upon some API, I cannot be sure that the API will not be removed a week from now. const command = new GetObjectCommand({
Key: "__key__",
Bucket: "__bucket__",
});
const endpoint = await getEndpointFromInstructions(command.input, GetObjectCommand, client.config); |
Due to a recent change in AWS SDKs, AWS service endpoints are now resolved by an internal ruleset, found in Because of the potential complexity of these rulesets, a service endpoint can no longer be resolved without additional pieces of information from the various While you might still have a reasonably good chance of getting the correct endpoint by using
You should be able to use a generic S3 URL format like @bizob2828
typings fix I submitted a PR to attempt to stabilize the client config API from this type of disruption: #4156. This also contains the type fix to set re: using internal API to resolve endpoint The code I provided works with the latest versions of P.S. I apologize for the disruption these updates and bugs are causing to your applications. The above steps are intended to prevent further occurrences. |
Just to add my tuppence worth. We have never specified an endpoint but we do specify a region in the creation of our SQSClient (and others like S3, SSM etc). So this raises a number of questions:
|
There are two similar but distinct object types associated with a client config. One is the config input type, what you send into The For example, in |
I see, thanks for clarifying. My interest is related to this where we were only using the config input type, as you describe it. Others seemed to have had the same issue. |
How does one use I used to be able to use the following code to delete a handled SQS message const endpoint = await sqs.config.endpoint()
const queueUrl = url.format({
...endpoint,
pathname: path.join(endpoint.path, accountId, queueName),
});
return await sqs.send(
new DeleteMessageCommand({
QueueUrl: queueUrl.toString(),
ReceiptHandle: receiptHandle,
})
); but the new equivalent is invalid. const fakeDeleteCommand = new DeleteMessageCommand({
ReceiptHandle: receiptHandle,
});
const endpoint = await getEndpointFromInstructions(
fakeDeleteCommand.input,
DeleteMessageCommand,
sqs.config
);
const queueUrl = url.format({
...endpoint,
pathname: path.join(endpoint.path, accountId, queueName),
});
return await sqs.send(
new DeleteMessageCommand({
QueueUrl: queueUrl.toString(),
ReceiptHandle: receiptHandle,
})
);
I guess maybe I can use GetQueueUrlCommand, but that looks like it's intended for cross-account stuff and would be overkill in this case. |
ok, turns out GetQueueUrlCommand won't work either (or, at least, I don't have anyway to determine the right input arguments. I'm just going to hold a v3.191.0 until y'all come up with a workable resolution. |
The endpoint The public API to delete queues by name is to call |
That still doesn’t help with deleting a message. The DeleteMessage command needs a QueueUrl argument, but there no longer appears to be a way to figure out what the URL should be based on message alone. |
in your example you use a |
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. |
Checkboxes for prior research
Describe the bug
The
S3Client
imported from@aws-sdk/client-s3
package has a breaking change in version3.192.0
. Following is the code to reproduce the issueThe
endpoint
method exists in version3.190.0
, but has been removed from the runtime code in3.192.0
.SDK version number
@aws-sdk/client-s3@3.192.0
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v18.11.0
Reproduction Steps
Installed the mentioned version of the
client-s3
and execute the following code.Observed Behavior
Exception is raised
Expected Behavior
Should work
Possible Solution
No response
Additional Information/Context
No response
The text was updated successfully, but these errors were encountered: