components icon indicating copy to clipboard operation
components copied to clipboard

Custom serverless components should return non-zero exit status on error

Open epleaner opened this issue 3 years ago • 0 comments

Description

Currently, with a custom serverless component (e.g a modified serverless.js), if an error is thrown in serverless.js while running serverless, the exit status will be zero, indicating success. This makes it more difficult to ensure that a deploy was successful in an automated environment.

Proposal

Return a non-zero exit status if an error is thrown in serverless.js

Current workaround using tee (please suggest improvements if I'm just unaware of a better method)

serverless | tee sls.out # store cmd output to temporary file
! grep "error:" sls.out # grep for error string, negate exit code because not finding error string => serverless cmd was success

epleaner avatar Dec 30 '20 20:12 epleaner