Skip to content

Commit 2a904a1

Browse files
committed
More logging
1 parent 033a971 commit 2a904a1

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

api/sockets/authHandler.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ export const handler = async (event: WebSocketEvent) => {
5353
const payload = await verifier.verify(token);
5454
console.log(`Validated: ${JSON.stringify(payload)}`);
5555
const { connectionId } = event.requestContext;
56-
5756
const userId = payload.sub;
5857

58+
console.log(`About to store the following record: ${JSON.stringify({ connectionId, userId})}`);
59+
5960
await ddbDocClient.send(
6061
new PutCommand({
6162
TableName: process.env.ABSTRACT_PLAY_TABLE!,
@@ -72,16 +73,6 @@ export const handler = async (event: WebSocketEvent) => {
7273
})
7374
);
7475
} catch (ex) {
75-
console.log("Connect error:", JSON.stringify(ex));
76-
const domain = event.requestContext.domainName;
77-
const stage = event.requestContext.stage;
78-
const connectionId = event.requestContext.connectionId;
79-
80-
const mgmt = new ApiGatewayManagementApiClient({
81-
endpoint: `https://${domain}/${stage}`,
82-
});
83-
84-
await mgmt.send(new DeleteConnectionCommand({ ConnectionId: connectionId }));
85-
return { statusCode: 401 };
76+
console.log("Subscribe error:", JSON.stringify(ex));
8677
}
8778
};

0 commit comments

Comments
 (0)