1 Answer
- Newest
- Most votes
- Most comments
1
Hopefully helping someone else out here - storing the region, stage, and apiId from the connection and using that - we were able to get cross-region chat to work.
Example:
export interface ConnectionRecord {
connectionId: string;
userId: string;
connectedAt: string;
apiId: string;
stage: string;
region: string;
}
function getGatewayAPI(connection: ConnectionRecord) {
if (GATEWAY_APIS[connection.region]) {
return GATEWAY_APIS[connection.region];
}
const endPoint = `https://${connection.apiId}.execute-api.${connection.region}.amazonaws.com/${connection.stage}`;
const apiGatewayManagement = new AWS.ApiGatewayManagementApi({
apiVersion: '2018-11-29',
endpoint: endPoint,
region: connection.region
});
GATEWAY_APIS\[connection.region] = apiGatewayManagement;
return apiGatewayManagement;
}
answered 3 years ago
Relevant content
- asked 2 years ago
- Accepted Answerasked 7 months ago
- asked 4 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 6 months ago