mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
fix(AWS Local Invocation): Fix invalid result handling
This commit is contained in:
parent
06c28e2c46
commit
bbff0290db
@ -799,7 +799,17 @@ class AwsInvokeLocal {
|
||||
if (result instanceof Error) {
|
||||
handleError.call(this, result);
|
||||
return;
|
||||
} else if (result.headers && result.headers['Content-Type'] === 'application/json') {
|
||||
}
|
||||
try {
|
||||
JSON.stringify(result);
|
||||
} catch (error) {
|
||||
throw new ServerlessError(
|
||||
`Function returned invalid (not a JSON stringifiable) value: ${inspect(result)}`,
|
||||
'INVALID_INVOKE_LOCAL_RESULT'
|
||||
);
|
||||
}
|
||||
|
||||
if (result.headers && result.headers['Content-Type'] === 'application/json') {
|
||||
if (result.body) {
|
||||
try {
|
||||
Object.assign(result, {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user