alexa / ask-cli

Alexa Skills Kit Command Line Interface

Home Page:https://developer.amazon.com/en-US/docs/alexa/smapi/ask-cli-intro.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deployment via Github Actions Failing

cfarmer-fearless opened this issue · comments

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request 
[ ] Other... Please describe: 

I would like to do automated deployments with Github Actions and the ask cli. This is for a self hosted skill in a Lambda function. The lambda function has already been created, and the alexa skill trigger has been configured using the correct skill ID. Here is my github action configuration yml file:

name: Hello World
on: [push]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout and deploy to dev
        uses: actions/checkout@v2
      - run: |
          sudo npm install -g ask-cli;
          cd lambda;
          npm install;
      - run: ask deploy --ignore-hash
        env:
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          ASK_ACCESS_TOKEN: ${{ secrets.ASK_ACCESS_TOKEN }}
          ASK_REFRESH_TOKEN: ${{ secrets.ASK_REFRESH_TOKEN }}
          ASK_VENDOR_ID: ${{ secrets.ASK_VENDOR_ID }}
          ASK_DEFAULT_PROFILE: default
          SKILL_ID: ${{ secrets.SKILL_ID }}

And here is my skills.json:

{
  "manifest": {
    "publishingInformation": {
      "locales": {
        "en-US": {
          "summary": "Sample Short Description",
          "examplePhrases": [
            "Alexa open hello world",
            "hello",
            "help"
          ],
          "name": "skill-sample-nodejs-hello-world",
          "description": "Sample Full Description"
        }
      },
      "isAvailableWorldwide": true,
      "testingInstructions": "Sample Testing Instructions.",
      "category": "KNOWLEDGE_AND_TRIVIA",
      "distributionCountries": []
    },
    "apis": {
      "custom": {
        "endpoint": {
          "uri": "<LAMBDA ARN>"
        }
      }
    },
    "manifestVersion": "1.0"
  }
}

Expected Behavior

The ask deploy command runs when a push is made to the main branch. The deploy command completes successfully and updates the skill.

Current Behavior

The deploy command fails with the following message:

"skill": {
    "resources": [
      {
        "action": "CREATE",
        "errors": [
          {
            "message": "The trigger setting for the Lambda <LAMBDA ARN> is invalid."
          }
        ],
        "name": "Manifest",
        "status": "FAILED"
      }
    ]
  },
  "status": "FAILED"

Steps to Reproduce (for bugs)

  1. Create a new alexa skill with the ask new command.
  2. Generate a lambda function and skill id by running ask deploy locally in the root directory of the new skill.
  3. Add the above github action configuration to the .github/workflows/action.yml file.
  4. Include the environment variables listed in this configuration in your github repo secrets.
  5. Push a new commit to the main branch.

Possible Solution

Your Environment and Context

  • ask-cli version: 2.26.0
  • Operating System and version: MacOS Monterey
  • Node.js version used for development: 12
  • NPM version used for development: 8.1.0

I finally was able to get this working by adding the __ENVIRONMENT_ASK_PROFILE__ profile to the .ask/ask-states.json. Phew!