Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

amplify_command: add_env returns message: Using default provider undefined #28

Open
dadamsGS opened this issue Dec 30, 2021 · 0 comments

Comments

@dadamsGS
Copy link

dadamsGS commented Dec 30, 2021

Not sure what I am doing wrong here but I have been trying to get amplify-cli-action working for the last three days.

local-env-info.json is added and not gitignored. I did not see anything in the README regarding the need to do this and it seems antithetical to using amplify-cli as they explicitly add it to the gitignore.

The error I am running into is:

Using default provider  undefined
init failed
TypeError [ERR_INVALID_ARG_TYPE]: The 'request' argument must be string. Received type undefined
    at /usr/local/lib/node_modules/@aws-amplify/cli/lib/lib/init-steps/s2-initProviders.js:22:36
    at Array.forEach (<anonymous>)
    at /usr/local/lib/node_modules/@aws-amplify/cli/lib/lib/init-steps/s2-initProviders.js:21:19
    at Generator.next (<anonymous>)
    at fulfilled (/usr/local/lib/node_modules/@aws-amplify/cli/lib/lib/init-steps/s2-initProviders.js:5:58)

I do have a project-config.json as well that is also not gitignored.

The command that is getting executed is (GHA output):

Run ambientlight/amplify-cli-action@0.3.0
  with:
    amplify_command: add_env
    amplify_env: greentest
    amplify_cli_version: 3.17.1-alpha.35
    delete_lock: false
    source_dir: src
    distribution_dir: dist
    build_command: npm run build
  env:
    AWS_ACCESS_KEY_ID: ***
    AWS_SECRET_ACCESS_KEY: ***
    AWS_REGION: us-east-2

Any direction on this would be really helpful.

My workflow file looks like:

# This workflow is designed to deploy the application client to AWS Amplify

name: Amplify Deploy

on:
  workflow_dispatch:

jobs:
  test:
    name: Deploy to test initiated by ${{ github.actor }}
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [16.x]

    steps:
    - uses: actions/checkout@v2

    - name: install amplify-cli
      run: npm install -g @aws-amplify/cli

    - name: use node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v2
      with:
        node-version: ${{ matrix.node-version }}
    
    - name: "set amplify env name"
      id: setenvname
      run: |
        # use GITHUB_REF_NAME that is set to PR source branch
        # ideally this is GREEN-d+
        ENVNAME=$(echo ${GITHUB_REF_NAME,,} | cut -c-10)
        ENVNAME="${ENVNAME//-/}"
        echo $ENVNAME
        echo "##[set-output name=amplifyenvname;]$ENVNAME"
  
    - name: Deploying to ${{ steps.setenvname.outputs.amplifyenvname }}
      uses: ambientlight/amplify-cli-action@0.3.0
      with:
        amplify_command: add_env
        amplify_env: greentest
        amplify_cli_version: '3.17.1-alpha.35'
        delete_lock: false
      env:
        AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
        AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        AWS_REGION: us-east-2

    # - name: deploy
    #   uses: ambientlight/amplify-cli-action@0.3.0
    #   with:
    #     amplify_command: publish
    #     amplify_env: test
    #   env:
    #     AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
    #     AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
    #     AWS_REGION: us-east-2
        
    # - name: undeploy test environment
    #   uses: ambientlight/amplify-cli-action@0.3.0
    #   # run even if previous step fails
    #   if: failure() || success()
    #   with:
    #     amplify_command: delete_env
    #     amplify_env: ${{ steps.setenvname.outputs.amplifyenvname }}
    #     amplify_cli_version: '3.17.1-alpha.35'
    #     delete_lock: false
    #   env:
    #     AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
    #     AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
    #     AWS_REGION: us-east-2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant