serverless / github-action

:zap::octocat: A Github Action for deploying with the Serverless Framework
Apache License 2.0
662 stars 173 forks source link

Undefined env vars for nodejs code #85

Closed RaFaTEOLI closed 1 year ago

RaFaTEOLI commented 1 year ago

When I deploy my nodejs api through the action it doesn't populate the nodejs env var for my database url, and it stays as undefined.

However it works for the aws keys.

BTW: it works normally when I deploy from my CLI, issue is only with the action.

How the deploy step looks like:

- name: serverless deploy --stage=dev
      uses: serverless/github-action@v3.2
      with:
        args: deploy
      env:
           AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
           AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
           DATABASE_URL: ${{ secrets.DATABASE_URL }}
RaFaTEOLI commented 1 year ago

Solved by adding the environment property in the provider.

environment:
    DATABASE_URL: ${env:DATABASE_URL}