I'm not that much expert using npm
and bitbucket-pipelines
, but I want to create a pipeline on Bitbucket to deploy my python (flask) project using serverless
to AWS Lambda. It's being deployed locally, but when I run it using the Bitbucket pipeline, this happens:
Error: Cannot find module '/opt/atlassian/pipelines/agent/build/node_modules/fs-extra/lib/index.js'. Please verify that the package.json has a valid "main" entry
Here is my code:
bitbucket-pipelines.yml
image: node:14.13.1-alpine3.10
pipelines:
branches:
master:
- step:
caches:
- node
script:
- apk add python3
- npm install
- npm install -g serverless
- serverless config credentials --stage dev --provider aws --key ${AWS_DEV_LAMBDA_KEY} --secret ${AWS_DEV_LAMBDA_SECRET}
- serverless deploy --stage dev
serverless.yml
service: serverless-flask
plugins:
- serverless-python-requirements
- serverless-wsgi
custom:
wsgi:
app: app.app
packRequirements: false
pythonRequirements:
dockerizePip: non-linux
provider:
name: aws
runtime: python3.8
stage: dev
region: us-west-2
functions:
app:
handler: wsgi.handler
events:
- http: ANY /
- http: 'ANY {proxy+}'
alert:
handler: alerts.run
events:
- schedule: rate(1 day)
package:
exclude:
- .venv/**
- venv/**
- node_modules/**
- bitbucket-pipelines.yml
How can I fix this?