4

I am trying to set up a workflow via the ask-cli for developing an Amazon skill with an Amazon lambda backend. I have created a skill and it works fine when using "ask api ..." commands, but when I use an "ask lambda ..." command, such as "ask lambda download -f MySkill", it uses the wrong region setting. I get the error:

ResourceNotFoundException: Function not found: arn:aws:lambda:us-east-1:123456789:function:MySkill

As you can see, it is looking for the lambda instance in us-east-1. But My lambda instance is in eu-west-1, as specified in my skill.json file below. This questions is pretty much a duplicate of https://forums.developer.amazon.com/questions/87922/ask-cli-does-not-use-region-setting-from-aws-confi.html. The answer in that question implies that you can add a region field somewhere in one of the json files, but I can't figure out where. Any help would be appreciated.

This is my ~/.ask/cli_config

{
  "profiles": {
    "default": {
      "aws_profile": "default",
      "token": {
        "access_token": "My_access_token",
        "refresh_token": "My_refresh_token",
        "token_type": "bearer",
        "expires_in": 3600,
        "expires_at": "2017-10-06T14:12:26.171Z"
      },
      "vendor_id": "My_vendor_id"
    }
  }
}

this is my ~/.aws/config

[default]
output = text
region = eu-west-1

This is my skill.json, that i get when i call: "ask api get-skill -s skill_id > skill.json"

{
  "skillManifest": {
    "publishingInformation": {
      "locales": {
        "en-GB": {
          "name": "My Skill"
        }
      },
      "isAvailableWorldwide": true,
      "category": "PUBLIC_TRANSPORTATION",
      "distributionCountries": []
    },
    "apis": {
      "custom": {
        "endpoint": {
          "uri": "arn:aws:lambda:eu-west-1:123456789:function:MySkill"
        },
        "interfaces": []
      }
    },
    "manifestVersion": "1.0"
  }
}
MyrionSC2
  • 1,248
  • 1
  • 14
  • 24
  • I have found a workaround for myself. Using ask's clone command to clone the skill also returns the code on the lambda instance. One can then use "ask deploy" to deploy changes to the lambda code. I still can't use "ask lambda ..." but atleast I can continue setting up the workflow. – MyrionSC2 Oct 09 '17 at 08:14
  • Please update the workaround you found in answer section so that it would be helpful for others who have the same issue – Vijayanath Viswanathan Oct 09 '17 at 12:05
  • It isn't really an answer though, just a workaround. I, and whoever sees this in the future, still can't use the "ask lambda ..." commands. – MyrionSC2 Oct 09 '17 at 12:46
  • Would love an answer to this...everything I've found online is just people with problems and no solutions – Henry Wilson Nov 21 '18 at 12:13

2 Answers2

0

for me it works if I edit the following file:

~/.aws/credentials (Linux, macOS, or Unix)

C:\Users\USERNAME\.aws\credentials (Windows)

[ask_cli_default]
aws_access_key_id=YOUR_AWS_ACCESS_KEY
aws_secret_access_key=YOUR_AWS_SECRET_KEY
region=eu-west-1
ManAnRuck
  • 234
  • 2
  • 10
0

The region os specified in the lambda section of .ask/config. Example:

        "lambda": [
          {
            "alexaUsage": [
              "custom/default"
            ],
            "arn": "arn:aws:lambda:eu-west-1:XXXXXXXXX:function:ask-premium-hello-world",
            "awsRegion": "eu-west-1",
            "codeUri": "lambda/custom",
            "functionName": "ask-premium-hello-world",
            "handler": "index.handler",
            "revisionId": "XXXXXXXXXXXXXXXXXX",
            "runtime": "nodejs8.10"
          }
        ]
German
  • 10,263
  • 4
  • 40
  • 56