forked from aws-amplify/amplify-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(amplify-nodejs-function-runtime-provider): fix lambda error format
return proper error message and stack if a string error is provided return string error as is fix aws-amplify#5553
- Loading branch information
Showing
7 changed files
with
66 additions
and
20 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
...fy-nodejs-function-runtime-provider/src/__tests__/utils/__snapshots__/invoke.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`test invoke with real depedencies should fail with proper error 1`] = `[Error: unexpected error]`; | ||
|
||
exports[`test invoke with real depedencies should fail with string error 1`] = `[Error: unexpected error]`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 2 additions & 6 deletions
8
packages/amplify-nodejs-function-runtime-provider/src/utils/invoke.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
packages/amplify-nodejs-function-runtime-provider/src/utils/invokeOptions.ts
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
packages/amplify-nodejs-function-runtime-provider/src/utils/invokeUtils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import path from 'path'; | ||
import * as execa from 'execa'; | ||
|
||
export type InvokeOptions = { | ||
packageFolder: string; | ||
handler: string; | ||
event: string; | ||
context?: object; | ||
environment?: { [key: string]: string }; | ||
}; | ||
|
||
export const getLambdaChildProcess = (environment: any, functionName: string = 'execute.js'): execa.ExecaChildProcess => { | ||
return execa.node(path.join(__dirname, functionName), [], { | ||
env: environment || {}, | ||
}); | ||
} |