1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

AWS SDK for JavaScript v3で大ハマりした件 (API Gateway WebSocket編)

Last updated at Posted at 2023-09-03

IoT Coreのendpointも注意 (Update: 2023/09/04)

v3はIoT Coreのendpointもhttps://を付ける必要があります。

AWS SDK for JavaScript v3

以下のDynamoDBに引き続き、API Gateway WebSocketでもv2->v3への移行で大ハマりしました。

問題と解決策

解決策を見つけたのはGitHubのissueでした。v3ではendpointにhttps://を付ける必要があります。

v2のAPI
const agma = new AWS.ApiGatewayManagementApi({
        apiVersion: "2018-11-29",
        endpoint: event.requestContext.domainName + "/" + event.requestContext.stage
    });
v3のAPI
// https://を付ける必要があります
const config = {
  endpoint: `https://${process.env.WEBSOCKET_ENDPOINT}/${event.requestContext.stage}`
};
const client = new ApiGatewayManagementApiClient({
  ...config
});
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?