Skip to content

Commit 580a92b

Browse files
committed
More logging
1 parent ec6e504 commit 580a92b

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

api/sockets/authHandler.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { CognitoJwtVerifier } from "aws-jwt-verify";
44
import { APIGatewayProxyEventV2 } from "aws-lambda";
55
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
6-
import { DynamoDBDocumentClient, PutCommand } from '@aws-sdk/lib-dynamodb';
6+
import { DynamoDBDocumentClient, GetCommand, PutCommand } from '@aws-sdk/lib-dynamodb';
77
import { ApiGatewayManagementApiClient, PostToConnectionCommand } from "@aws-sdk/client-apigatewaymanagementapi";
88

99
type WebSocketRequestContext = APIGatewayProxyEventV2["requestContext"] & {
@@ -76,7 +76,19 @@ export const handler = async (event: WebSocketEvent) => {
7676
})
7777
);
7878
console.log(`Result: ${JSON.stringify(result)}`);
79-
console.log("Record written");
79+
80+
// get the record to make sure
81+
const getRec = await ddbDocClient.send(
82+
new GetCommand({
83+
TableName: process.env.ABSTRACT_PLAY_TABLE,
84+
Key: {
85+
"pk": "wsConnections",
86+
"sk": connectionId
87+
},
88+
})
89+
);
90+
console.log(`Found record: ${JSON.stringify(getRec)}`);
91+
8092
// Now send a message back to the client
8193
const apiGwClient = new ApiGatewayManagementApiClient({
8294
region: REGION,

0 commit comments

Comments
 (0)