File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import type { LambdaEvent } from 'lambda-local'
8
8
import { chalk , logPadded , NETLIFYDEVERR } from '../../utils/command-helpers.js'
9
9
import renderErrorTemplate from '../render-error-template.js'
10
10
11
- import { detectAwsSdkError } from './utils.js'
11
+ import { warnIfAwsSdkError } from './utils.js'
12
12
import type { InvocationError } from './netlify-function.js'
13
13
14
14
// Annoyingly, `isReadableStream` refines to the `Readable` interface rather than the
@@ -152,8 +152,7 @@ const handleErr = async (
152
152
request : express . Request ,
153
153
response : express . Response ,
154
154
) => {
155
- // @ts -expect-error -- XXX(serhalp): Expects `error` but passes `err`, so it has never worked. Fixed in stacked PR.
156
- detectAwsSdkError ( { err } )
155
+ warnIfAwsSdkError ( { error : err } )
157
156
158
157
const acceptsHtml = request . headers . accept ?. includes ( 'text/html' ) ?? false
159
158
const errorString = typeof err === 'string' ? err : formatLambdaLocalError ( err , acceptsHtml )
Original file line number Diff line number Diff line change @@ -3,8 +3,7 @@ import { MISSING_AWS_SDK_WARNING } from '../log.js'
3
3
4
4
import type { InvocationError } from './netlify-function.js'
5
5
6
- // TODO(serhalp): Rename? This doesn't "detect", it maybe logs a warning.
7
- export const detectAwsSdkError = ( { error } : { error : Error | InvocationError | string } ) : void => {
6
+ export const warnIfAwsSdkError = ( { error } : { error : Error | InvocationError | string } ) : void => {
8
7
const isAwsSdkError =
9
8
typeof error === 'object' &&
10
9
'errorMessage' in error &&
@@ -16,10 +15,10 @@ export const detectAwsSdkError = ({ error }: { error: Error | InvocationError |
16
15
}
17
16
}
18
17
19
- // XXX(serhalp): This appears to be a bug? In the background and scheduled function code paths this can receive plain
20
- // errors, but this is assuming normalized `InvocationError`s only.
21
18
export const formatLambdaError = ( err : Error | InvocationError ) : string =>
22
- chalk . red ( `${ 'errorType' in err ? err . errorType : '' } : ${ 'errorMessage' in err ? err . errorMessage : '' } ` )
19
+ chalk . red (
20
+ `${ 'errorType' in err ? err . errorType : 'Error' } : ${ 'errorMessage' in err ? err . errorMessage : err . message } ` ,
21
+ )
23
22
24
23
// should be equivalent to https://github.com/netlify/proxy/blob/main/pkg/functions/request.go#L105
25
24
const exceptionsList = new Set ( [
You can’t perform that action at this time.
0 commit comments