Skip to content

Commit 4e0c0fc

Browse files
authored
docs: add remark about SQS custom endpoints (#5780)
1 parent cbba32c commit 4e0c0fc

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

UPGRADING.md

+40-1
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ In v3, the similar utility function is available in [`@aws-sdk/polly-request-pre
571571

572572
## Notes on Specific Service Clients
573573

574-
### Lambda
574+
### AWS Lambda
575575

576576
Lambda invocations response type differs in v3:
577577

@@ -616,3 +616,42 @@ const region = "...";
616616
console.log("Invoke response object", payloadObject);
617617
}
618618
```
619+
620+
### Amazon SQS
621+
622+
When using a custom `QueueUrl` in SQS operations that have this as an input parameter, in JSv2
623+
it was possible to supply a custom `QueueUrl` which would override the SQS Client's default endpoint.
624+
625+
In JSv3, when using a custom endpoint, i.e. one that differs from the default public SQS endpoints, you
626+
should always set the endpoint on the SQS Client as well as the `QueueUrl` field.
627+
628+
```ts
629+
import { SQS } from "@aws-sdk/client-sqs";
630+
631+
const sqs = new SQS({
632+
// client endpoint should be specified in JSv3 when not the default public SQS endpoint for your region.
633+
// This is required for versions <= v3.506.0
634+
// This is optional but recommended for versions >= v3.507.0 (a warning will be emitted)
635+
endpoint: "https://my-custom-endpoint:8000/",
636+
});
637+
638+
await sqs.sendMessage({
639+
QueueUrl: "https://my-custom-endpoint:8000/1234567/MyQueue",
640+
Message: "hello",
641+
});
642+
```
643+
644+
If you are not using a custom endpoint, then you do not need to set `endpoint` on the client.
645+
646+
```ts
647+
import { SQS } from "@aws-sdk/client-sqs";
648+
649+
const sqs = new SQS({
650+
region: "us-west-2",
651+
});
652+
653+
await sqs.sendMessage({
654+
QueueUrl: "https://sqs.us-west-2.amazonaws.com/1234567/MyQueue",
655+
Message: "hello"
656+
});
657+
```

0 commit comments

Comments
 (0)