Skip to content

Commit

Permalink
switch to try catch and add console.debug
Browse files Browse the repository at this point in the history
  • Loading branch information
rtpascual committed Jan 22, 2025
1 parent fcfd289 commit 306fd62
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions packages/backend-function/src/lambda-shims/invoke_ssm_shim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,18 @@ await internalAmplifyFunctionResolveSsmParams();

const SSM_PARAMETER_REFRESH_MS = 1000 * 60;

setInterval(() => {
// Catch errors and do nothing in the case we are retrieving secrets when the Lambda starts shutting down
// eslint-disable-next-line promise/prefer-await-to-then
void internalAmplifyFunctionResolveSsmParams().catch(() => {});
// eslint-disable-next-line @typescript-eslint/no-misused-promises
setInterval(async () => {
try {
await internalAmplifyFunctionResolveSsmParams();
} catch (error) {
try {
// Attempt to log error
// eslint-disable-next-line no-console
console.debug(error);
// eslint-disable-next-line amplify-backend-rules/no-empty-catch
} catch (error) {
// Do nothing if logging fails
}
}
}, SSM_PARAMETER_REFRESH_MS);

0 comments on commit 306fd62

Please sign in to comment.