I have two serverless.yml for two different services, my project structure is as below:
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.
@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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.