Skip to content

Commit 58430c2

Browse files
committed
fix(fetch-ssm-string-param-value): add error handling for non-OK responses
1 parent ed37cd2 commit 58430c2

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

packages/lambda-utilities/src/ssm/fetch-ssm-string-param-value.function.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ export async function fetchSsmStringParamValue(parameterArn: string, withDecrypt
3131
},
3232
})
3333

34+
if (!response.ok) {
35+
const responseBody = await response.text()
36+
throw new Error(
37+
`HTTP ${response.status} ${response.statusText} fetching ssm parameter ${parameterArn} from lambda layer. Body: ${responseBody}`,
38+
)
39+
}
40+
3441
const result: GetParameterResult = await response.json()
3542
if (!result?.Parameter?.Value) {
3643
throw new Error(

0 commit comments

Comments
 (0)