Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Serverless deploy pipe is not packaging service according to include/excludes

I have two serverless.yml for two different services, my project structure is as below:

  • src
    • auth
      • handle.js
      • serverless.yml
    • service
      • index.js
  • serverless.yml

 

my bitbucket-pipeline.yml looks something like this:

pipelines:
branches:
master:
-
step:
name: Deploy Authorizer
caches:
-
node
script:
-
pipe: atlassian/serverless-deploy:0.2.2
variables:
CONFIG: "./src/auth/serverless.yml"
[AWS_CREDS]


-
step:
name: Deploy to Production
deployment: production
caches:
-
node
script:
-
npm install
-
pipe: atlassian/serverless-deploy:0.2.2
variables:
 [AWS_CREDS]

 

My auth/serverless.yml has this in it:

package:
include:
- handler.js

 

My service and auth lambdas get deployed successfully, but the zipped package for my auth lambda includes my entire project, even with the package/include specifying that I only want that one handler.js file included.

 

This causes issues when the lambda is deployed since the serverless.yml specifies the handler path relative to the serverless.yml, but once it's in AWS with all the extra project files, the relative path breaks and it can't execute the code in handler.js

 

Right now, this seems like a bug because when just doing a:

serverless package

in my auth directory, the handler.js is correctly the only file that's in the zipped package. But through the bitbucket pipe, it ignores the include option and shoves everything in there.

1 answer

0 votes

@Alejandro Torroella I suspect it includes your entire project because you're located not in auth directory before executing pipe, but in the root.

So by default, serverless packages your entire project.

Based on this I can propose you either change directory by cd-in to the right directory before pipe execution or do not package if that satisfy your requirements and deploy from a directory (See subscection `Deployment from a pre-packaged directory` https://www.serverless.com/framework/docs/providers/aws/cli-reference/deploy/).

We are looking forward to hearing from you, if that would work for you, otherwise we will try to reproduce and find the answer together or to make some change to make it more adaptable.

Regards, Galyna

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

Security Advisory for Jira Service Management

On October 20, 2021, Atlassian published a security advisory for Jira Service Management. The full advisory is available at this link.  We've seen a number of questions already asking for...

75 views 0 1
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you