Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit code 0 even though deployment fails #1377

Closed
johnsgp opened this issue Jun 22, 2016 · 8 comments
Closed

Exit code 0 even though deployment fails #1377

johnsgp opened this issue Jun 22, 2016 · 8 comments

Comments

@johnsgp
Copy link

johnsgp commented Jun 22, 2016

I'm using serverless 0.5.5.

When I run serverless event deploy before deploying the lambda function, I get something like this:

Serverless: Deploying events in "dev" to the following regions: eu-west-1
Serverless: Failed to deploy events in "dev" to the following regions:
Serverless: eu-west-1 ------------------------
Serverless:   schedule: Cannot find alias arn: arn:aws:lambda:eu-west-1:.....
Serverless:
Serverless: Run this again with --debug to get more error information...

The process returns exit code 0 which I then cannot detect as an error with a continuous integration tool.

There are similar problems with deployment of functions and endpoints, e.g., when the _meta/_tmp folder is not writeable. The common feature is the last line, prompting to run again with --debug.

Is there an option to make such failures into return exit code 1?

@stevecaldwell77
Copy link
Contributor

stevecaldwell77 commented Jun 22, 2016

I'm running into the same issue. Came in this morning to find my lambda functions hadn't been executing overnight, because deploying their scheduled event failed silently in travis.

As a side note, an event name longer than 64 chars seems like a common-ish use case with the way serverless builds them up.

Serverless: Deploying events in "travis" to the following regions: us-east-1
Serverless: Failed to deploy events in "travis" to the following regions:
Serverless: us-east-1 ------------------------
Serverless:   myLongEventName012345: 1 validation error detected: Value 'my_project_name-my_longish_function_name-myLongEventName012345-travis' at 'name' failed to satisfy constraint: Member must have length less than or equal to 64
Serverless:
Serverless: Run this again with --debug to get more error information...

@csterwa
Copy link

csterwa commented Jul 2, 2016

I'm getting the same with failed deployment of endpoints:

Serverless: Failed to deploy endpoints in "dev" to the following regions:  
Serverless: us-east-1 ------------------------  

@flomotlik
Copy link
Contributor

@johnsgp this is resolved in Serverless V1. The system exits properly with 1 if the deployment fails so I'll close this issue. Thanks for reporting.

@RickvdP
Copy link

RickvdP commented May 27, 2018

Looks like this is still happening, did I miss anything?

[Container] 2018/05/27 14:26:48 Running command serverless deploy --stage cicd | tee deploy.out
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Tracing ENABLED for function "template-service-cicd-hello"
 
  Serverless Error ---------------------------------------
 
  ServerlessError: User: arn:aws:sts::1234:assumed-role/code-build-template-service-service-role/AWSCodeBuild-abc is not authorized to perform: cloudformation:DescribeStacks on resource: arn:aws:cloudformation:eu-west-1:1234:stack/template-service-cicd/*
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com
 
  Your Environment Information -----------------------------
     OS:                     linux
     Node Version:           6.3.1
     Serverless Version:     1.27.3
 

[Container] 2018/05/27 14:26:52 Phase complete: BUILD Success: true

Amazon CodeBuild still marks the output as Success: true. I just verified that outputting exit 1 actually translates into Success: false too.

Any suggestions?

@traviswimer
Copy link

I'm seeing the same problem.

@traviswimer
Copy link

Actually, nevermind. Serverless does seem to be using the correct exit code.

I think I was getting a 0 exit code because I was running it as a script in my package.json (e.g. npm run serverless_thing). Apparently the exit codes of the commands within an npm script do not get passed through.

@RickvdP , I would bet your problem is caused by piping into tee deploy.out, since that part would presumably succeed.

@abmohan
Copy link

abmohan commented Jul 2, 2018

@traviswimer - thanks for the update. I encountered the same problem

@kaitlynbrown
Copy link

kaitlynbrown commented Aug 7, 2019

I'm encountering the same problem
edit: turned out to be because of an issue in serverless-offline fixed by dherault/serverless-offline#767

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants