ask-cli: Cannot change Lambda ARN

I am using Ask v2.20.0 and I am trying to change the Lambda ARN defined in skill.json

I created the project first with ask init and a fresh Lambda Function was created, but I want to hook the skill up to an existing Function.

So I changed the ARN in skill.json and used ask deploy but the ARN was changed back.

I tried changing the endpoint in the Alexa web console, and saved, and tried deploying (via CLI) again, but the JOSN config still reverted back to the fresh Function ARN.

Is it possibly to change the ARN, at all? Or am I stuck using the one that is created when I create the skill?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 23 (11 by maintainers)

Most upvoted comments

@paul-uz

  1. I agree it would be more beneficial to allow the setting of a custom ARN name or possibly creating lambda if sourceLambda -> arn is specified. I will talk to the team about adding it.
  2. Yes. You need to have .ask/ask-states.json in source control. ask cli will created new skill if you dont have this file(it has skill id). There is also lambda arn in skill-package/skill.json under manifest ->apis -> custom. If you deleted .ask folder, you also need delete endpoint under manifest ->apis -> custom. I know it is confusing, but this is how it was designed and changing it would be a breaking change.

@paulcanning and @paul-uz have you tried using CloudFormation deployer? I think you can accomplish having custom Lambda name. You can pass extra parameters to CFN deployer in ask-resources.json. You can use the parameter infrastructure/cfn-deployer/skill-stack.yaml. I would encourage to use CFN deployer instead of Lambda deployer since it is more customizable.

ask-resources.json

{
  "askcliResourcesVersion": "2020-03-31",
  "profiles": {
    "default": {
      "skillMetadata": {
        "src": "./skill-package"
      },
      "code": {
        "default": {
          "src": "./lambda"
        }
      },
      "skillInfrastructure": {
        "userConfig": {
          "runtime": "nodejs10.x",
          "handler": "index.handler",
          "templatePath": "./infrastructure/cfn-deployer/skill-stack.yaml",
          "awsRegion": "us-east-1",
          "cfn": {
            "parameters": {
              "LambdaName": "my-custom-name"
            }
          }
        },
        "type": "@ask-cli/cfn-deployer"
      }
    }
  }
}

infrastructure/cfn-deployer/skill-stack.yaml

AWSTemplateFormatVersion: 2010-09-09
Parameters:
...
  LambdaName:
    Type: String
Resources:
...
  AlexaSkillFunction:
    Type: AWS::Lambda::Function
    Properties:
      FunctionName: !Ref LambdaName
     ....