question

KralikX avatar image
KralikX asked

"The trigger setting for the Lambda arn:... is invalid." problem for separately deployed Lambda.

Hi all,

I'm trying to automate my existing Alexa skill deployment using ASK CLI. I started with sample skill.json, tweaking it according to validation errors given by "ask deploy". However now I am stuck with the error:

"The trigger setting for the Lambda <my lambda ARN> is invalid."

I found a hint on this forum suggesting to check that Skill ID in Lambda trigger matches ID of the deployed skill, but it does. What might be related is that I deploy Lambda separately via Cloudformation template and not with ASK CLI.

Any ideas?

My skill.json looks like this:

{
  "manifest": {
    "publishingInformation": {
      "locales": {
        "en-US": {
          "summary": "Sample Short Description",
          "examplePhrases": [
            "Alexa open hello world",
            "Alexa tell hello world hello",
            "Alexa ask hello world say hello"
          ],
          "name": "ask-test-skill",
          "description": "Sample Full Description"
        }
      },
      "isAvailableWorldwide": true,
      "testingInstructions": "Sample Testing Instructions.",
      "category": "EDUCATION_AND_REFERENCE",
      "distributionCountries": []
    },
    "apis": {
      "custom": {
        "endpoint": {
          "uri": "<my Lambda ARN>"
        }
  }
    },
    "manifestVersion": "1.0",
"permissions": [
      {
        "name": "alexa::devices:all:address:full:read"
      }
    ],
    "privacyAndCompliance": {
      "allowsPurchases": false,
      "usesPersonalInfo": false,
      "isChildDirected": false,
      "isExportCompliant": true,
      "containsAds": false,
      "locales": {
        "en-US": {
          "privacyPolicyUrl": "http://www.myprivacypolicy.sampleskill.com",
          "termsOfUseUrl": "http://www.termsofuse.sampleskill.com"
        }
      }
    },
    "events": {
      "endpoint": {
        "uri": "<my Lambda ARN>"
      },
      "subscriptions": [
        {
          "eventName": "SKILL_ENABLED"
        },
        {
          "eventName": "SKILL_DISABLED"
        },
        {
          "eventName": "SKILL_PERMISSION_ACCEPTED"
        },
        {
          "eventName": "SKILL_PERMISSION_CHANGED"
        },
        {
          "eventName": "SKILL_ACCOUNT_LINKED"
        }
      ],
      "regions": {
        "NA": {
          "endpoint": {
            "uri": "<my Lambda ARN>"
          }
        }
      }
    }
  }
}

Thanks in advance!

Richard.

alexa skills kitlambdaask cli
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Amazon_Bernardo Bezerra avatar image
Amazon_Bernardo Bezerra answered

Hi Richard an thank you for your message.

I see that you are facing some issues when deploying your lambda code using ASKCLI.

Looking at the skill.json you posted, one thinks caught my eye: under apis:custom:endpoint you have uri:<Lambda_ARN>, where it should be sourceDir:lambda/custom. In other words, the path to your index.js.

Can you please try making this change and letting me know if it helped you?

Regards,

Barry

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

KralikX avatar image
KralikX answered

Hi Barry, thanks for your tip.

Unfortunately my Lambda is Java-based (I have a java library I'd like to use) and I haven't found neither example or post for this scenario so I had to experiment a bit. This setting tries to mimic my manual setup in Alexa dev console - which works - as closely as possible.

Error message itself seems like deployment code has found the Lambda by its ARN since it has some problem with the trigger, but it might just be a misinterpreted error state.

Will be glad for any ideas!

Thanks, Richard.

1 comment
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Amazon_Bernardo Bezerra avatar image Amazon_Bernardo Bezerra ♦♦ commented ·

Hi Richard,

I don't know if you are aware, but there is repository in github with 11 sample codes in Java. Trying to move from the pom.xml to the skill.json format can be tricky and could definitely be where the issue is.

Let me know if this helps!

Regards,

Barry

0 Likes 0 ·
newuser-27474971-0cc9-42a2-8514-d4213f90d8bc avatar image
newuser-27474971-0cc9-42a2-8514-d4213f90d8bc answered

I ran into the same issue! It seems like ASK checks your lambda to ensure that ASK is set at a trigger to the lambda and that your skill ID is configured in the trigger. Well, the problem is that you don't have a skill ID until you actually make the skill so you can't set up your lambda ahead of time. I got around this by...

1) Remove any fulfillment info from the manifest and create your skill without it

2) Configure your ASK Lambda trigger with the skill ID you just created

3) Update the manifest with your Lambda ARN fulfillment info

4) Update the skill

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.