Skip to content

Commit 1bf21f3

Browse files
authored
SAM run/debug: do not stringify the error from got #2263
* Do not stringify the error from got * Use status message * Check for refused
1 parent f666f4d commit 1bf21f3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/shared/sam/localLambdaRunner.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -475,12 +475,14 @@ async function requestLocalApi(
475475
methods: [reqMethod],
476476
calculateDelay: obj => {
477477
if (obj.error.response !== undefined) {
478-
getLogger().debug('Local API response: %s : %O', uri, JSON.stringify(obj.error.response))
478+
getLogger().debug('Local API response: %s : %O', uri, obj.error.response.statusMessage)
479479
}
480-
if (obj.error.code === 'ETIMEDOUT') {
480+
if (obj.error.code === 'ETIMEDOUT' || obj.error.code === 'ECONNREFUSED') {
481481
return 0
482482
}
483-
getLogger().debug(`Local API: retry (${obj.attemptCount} of ${RETRY_LIMIT}): ${uri}: ${obj.error}`)
483+
getLogger().debug(
484+
`Local API: retry (${obj.attemptCount} of ${RETRY_LIMIT}): ${uri}: ${obj.error.message}`
485+
)
484486
return RETRY_DELAY
485487
},
486488
},
@@ -496,7 +498,7 @@ async function requestLocalApi(
496498
getLogger().info('Local API is alive: %s', uri)
497499
return
498500
}
499-
const msg = `Local API failed to respond (${err.code}) after ${RETRY_LIMIT} retries, path: ${api?.path}, error: ${err}`
501+
const msg = `Local API failed to respond (${err.code}) after ${RETRY_LIMIT} retries, path: ${api?.path}, error: ${err.message}`
500502
getLogger('channel').error(msg)
501503
throw new Error(msg)
502504
})

0 commit comments

Comments
 (0)