nodejs-health-checker
Version:
Simple Nodejs package to simplify applications based in Node, to trace the healthy of the pods
27 lines • 894 B
JavaScript
export async function checkDynamodbClient(config) {
let client;
try {
// lazy loading aws-sdk/client-dynamodb package to enable peer dependency to be optional
const aws = await import("@aws-sdk/client-dynamodb");
client = new aws.DynamoDBClient({
endpoint: config.host,
region: config.Aws?.region || "us-east-1",
credentials: {
accessKeyId: config.Aws?.access_key_id || "",
secretAccessKey: config.Aws?.secret_access_key || "",
},
maxAttempts: 1,
});
const result = await client.send(new aws.ListTablesCommand({}));
return { status: !!result };
}
catch (error) {
return { status: false, error };
}
finally {
if (client) {
client.destroy();
}
}
}
//# sourceMappingURL=dynamodb-service.js.map