Hi All,
I using Github actions and serverless to deploy a Python AWS Lambda Application. The libraries I have in my requirements.txt are not being added to my lambda functions. I confirmed this by logging the included libraries in my lambda with
installed_packages = pkg_resources.working_set
installed_packages_list = sorted(
["%s==%s" % (i.key, i.version) for i in installed_packages]
)
This results in the following log:
Comparing that log with my requirements.txt you can see numpy and scipy are missing:
boto3==1.16.36
botocore==1.19.36
jmespath==0.10.0
numpy==1.19.4
python-dateutil==2.8.1
python-json-logger==2.0.1
s3transfer==0.3.3
scipy==1.5.4
six==1.15.0
tqdm==4.54.1
urllib3==1.26.2
git+ssh://git@github.com/jeb2162/model_scoring.git
My github workflow is below:
name: Model Scoring Service Dev Deployment
on:
push:
branches:
- "**"
- "!master"
jobs:
deploy:
name: deploy
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
STAGE: dev
SLS_DEBUG: '*'
steps:
#- uses: actions/checkout@v1
- uses: actions/checkout@master
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- uses: webfactory/ssh-agent@v0.4.1
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Install dependencies
run: npm install
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Serverless Deploy
run: npm run-script deploy
Here are the relevant parts of my serverless.yml:
service: model-scoring-service
package:
individually: false
exclude:
- v-lambda-env/**
- node_modules/**
- package.json
- package-log.json
include:
- requirements.txt
provider:
name: aws
runtime: python3.7
stage: ${env:STAGE}
custom:
datadog:
flushMetricsToLogs: true
addLayers: true
logLevel: "DEBUG"
enableXrayTracing: false
enableDDTracing: true
forwarder: arn:aws:lambda:us-east-1:837515578404:function:datadog-forwarder-Forwarder-1GTYASGLQWO8H
enableTags: true
injectLogContext: true
pythonRequirements:
dockerizePip: true
dockerSsh: true
zip: true
slim: false
dockerSshSymlink: ~/.ssh
plugins:
- serverless-pseudo-parameters
- serverless-plugin-datadog
- serverless-python-requirements
Any input/help on why my requirements are getting added to the lambda would be appreciated!