serverless-plugin-select icon indicating copy to clipboard operation
serverless-plugin-select copied to clipboard

Cannot skip lambda deployment based on stage if the lambda has never been deployed

Open klindklind opened this issue 5 years ago • 1 comments

I'm trying to deploy one particular lambda only to my dev environment.

My serverless.yml looks like this:

plugins:
  - serverless-plugin-select
  ...
dev-only:
    stages:
      - dev
    handler: src/dev-only.handler
    events:
      - http:
          path: /dev-only
          method: get

   ... (and bunch of other functions)

When I do sls deploy --stage dev that dev-only function is deployed and no errors thrown, great!

But when I try to deploy that same serverless project into staging stage the CloudFormation update completes fine but serverless framework artifact modification throws an error:

Serverless: Removing old service artifacts from S3...

  Serverless Error ---------------------------------------

  Function "dev-only" doesn't exist in this Service

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              12.16.2
     Framework Version:         1.62.0
     Plugin Version:            3.3.0
     SDK Version:               2.3.0
     Components Core Version:   1.1.2
     Components CLI Version:    1.4.0

I checked the source code which looks like it doesn't handle the situation where I want to skip function deploy in stage where that function hasn't ever been deployed.

Am I missing something here or is this a bug that needs fixing?

klindklind avatar May 28 '20 10:05 klindklind

@klindklind Are you still seeing this behavior? Seems annoying to have to deploy a function by setting the stage, and subsequently blacklisting it by removing the stage. Trying to figure out if this is a worthwhile plugin to use, or if I should look elsewhere. Thanks!

@goncaloneves Any insights you might be able to provide?

createchange avatar Nov 30 '20 19:11 createchange