File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,13 +18,16 @@ export async function GET() {
1818 const { getAppCredentials, getAppRegion } = await import ( "../../lib/aws/credentials" ) ;
1919 const creds = getAppCredentials ( ) ;
2020 if ( creds || process . env . AWS_REGION ) {
21- const { DynamoDBClient, DescribeTableCommand } = await import ( "@aws-sdk/client-dynamodb" ) ;
21+ const { DynamoDBClient } = await import ( "@aws-sdk/client-dynamodb" ) ;
22+ const { DynamoDBDocumentClient, GetCommand } = await import ( "@aws-sdk/lib-dynamodb" ) ;
2223 const table = process . env . DYNAMODB_USERS_TABLE || "autisense-users" ;
2324 const client = new DynamoDBClient ( {
2425 region : getAppRegion ( "ap-south-1" ) ,
2526 ...( creds && { credentials : creds } ) ,
2627 } ) ;
27- await client . send ( new DescribeTableCommand ( { TableName : table } ) ) ;
28+ const docClient = DynamoDBDocumentClient . from ( client ) ;
29+ // Use GetItem (allowed by IAM policy) instead of DescribeTable (not allowed)
30+ await docClient . send ( new GetCommand ( { TableName : table , Key : { id : "__health_check__" } } ) ) ;
2831 checks . dynamodb = "ok" ;
2932 } else {
3033 checks . dynamodb = "no_credentials" ;
You can’t perform that action at this time.
0 commit comments