-
Notifications
You must be signed in to change notification settings - Fork 176
Open
Description
Hey,
I am currently unsucessfully trying to deploy a python serverless function with the github action.
My deploy.yml
:
jobs:
deploy:
name: deploy
runs-on: ubuntu-20.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version-file: '.python-version'
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- run: npm ci
- name: Deploy
uses: serverless/github-action@v3.1
with:
args: deploy --stage ${{ github.ref_name }} --verbose
env:
SERVERLESS_ACCESS_KEY: ${{ secrets.SERVERLESS_ACCESS_KEY }}
I also tried it with the approach suggested in the README.md
, using
- name: Install Plugin and Deploy
uses: serverless/github-action@v3.1
with:
args: -c "serverless plugin install --name <plugin-name> && serverless deploy"
entrypoint: /bin/sh
but it did not work either. (If I am understanding the workflow correctly, npm ci
should install the plugin, and the error message is coming from the plugin, so I think it should work either way)
The error I am getting is:
Running "serverless" from node_modules
Deploying <service> to stage staging (eu-central-1, "<provider>" provider)
Generated requirements from /github/workspace/requirements.txt in /github/workspace/.serverless/requirements.txt
Installing requirements from "/github/home/.cache/serverless-python-requirements/f8090527365eda7859729a5727d2f20270cee426c486e19c25ce91c8df2a8a66_x86_64_slspyc/requirements.txt"
Using download cache directory /github/home/.cache/serverless-python-requirements/downloadCacheslspyc
× Stack <service>-staging failed to deploy (0s)
Environment: linux, node 16.16.0, framework 3.21.0 (local) 3.21.0v (global), plugin 6.2.2, SDK 4.3.2
Credentials: Serverless Dashboard, "<provider>" provider (https://app.serverless.com/<provider>)
Docs: docs.serverless.com
Support: forum.serverless.com
Bugs: github.com/serverless/serverless/issues
Error:
Error: `python3.9 -m pip help install` Exited with code 1
at ChildProcess.<anonymous> (/github/workspace/node_modules/child-process-ext/spawn.js:38:8)
at ChildProcess.emit (node:events:527:28)
at ChildProcess.emit (node:domain:475:12)
at maybeClose (node:internal/child_process:1092:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
I think the error occurs here, but I can't quite grasp why the plugin should not be able to access python?
Do you know how to fix this?
GrantWatts, vncsna, ecukalla and guimorone
Metadata
Metadata
Assignees
Labels
No labels
Activity
AntonOellerer commentedon Jul 25, 2022
If I install
serverless
withnpm
and then runnpm exec -c 'serverless deploy --stage ${{ github.ref_name }} --verbose'
it workssergiors commentedon Sep 29, 2022
you need to use
serverless/github-action@v3
JoMingyu commentedon Oct 27, 2022
this saved me
walterholohan commentedon Feb 13, 2023
Thank you, anyone know why 3.1 does not work for python deployments?
sergiors commentedon Feb 13, 2023
The only reason that it could be is the node version, maybe python version
jnicho02 commentedon Mar 15, 2023
correct me if i'm wrong, but the 'with: args: ...serverless deploy' command will run inside serverless/github-action's Docker....3.1's Dockerfile is based on nikolaik/python-nodejs:python3.10-nodejs16-slim so when serverless tries to run
python3.9 -m pip help install
....then there won't be a python3.9, only a python3.10and you can't use a python3.10 lambda profile as it doesn't exist yet https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html
advissor commentedon Jun 7, 2023
Indeed, same happening for Python lambdas with v3.2 of this github action
@jnicho02 points in right direction
The Docker image, that is used and being built in the github actions uses Python 3.10 already for versions of Github actions above >3
Using serverless/github-action@v3 for Python 3.9 helped