0
votes

I'm using node-aws-lambda to deploy a lambda function directly using gulp and node.js. The function itself is being deployed properly. However, the trigger I try to configure is using an Amazon Alexa Smart Home Skill ARN. The validation complains that this ARN is not allowed.

This is my config (access and policies are fine):

module.exports = {
  accessKeyId: 'AAAAAAAAAAAAAAAAAAA',  // User: 
  secretAccessKey: 'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB',  // optional
  region: 'eu-west-1',
  handler: 'index.handler',
  role: 'arn:aws:iam::1234567890:role/SmartHomeSkillRole', // KNXSmartHomeSkillRole
  functionName: 'SmartHomeSkill_Remote',
  timeout: 10,
  memorySize: 128,
  publish: true,
  runtime: 'nodejs4.3',
  description: 'A remotely build skill for alexa',
  eventSource: {
    EventSourceArn: 'amzn1.ask.skill.d9d9f7b1-f7d6-4050-a3d1-753e47e7038a', 
    BatchSize: 200,
    StartingPosition: "TRIM_HORIZON"
  }
}

The value in EventSourceArn is being the failure's source (amzn1.ask.skill is not valid, while putting the trigger in manually in the console works well):

ValidationException: 1 validation error detected: Value 'amzn1.ask.skill.d9d9f7b1-f7d6-4050-a3d1-753e47e7038a' at 'eventSourceArn' failed to satisfy constraint: Member must satisfy regular  expression pattern: arn:(aws|aws-us-gov):([a-zA-Z0-9\-])+:([a-z]{2}(-gov)?-[a-z]+-\d{1})?:(\d{12})?:(.*)
    at Object.extractError (E:\DropBox\p\jisageek\IoT\AlexaKNX\node_modules\aws-sdk\lib\protocol\json.js:48:27)
    at Request.extractError (E:\DropBox\p\jisageek\IoT\AlexaKNX\node_modules\aws-sdk\lib\protocol\rest_json.js:37:8)
    at Request.callListeners (E:\DropBox\p\jisageek\IoT\AlexaKNX\node_modules\aws-sdk\lib\sequential_executor.js:105:20)
    at Request.emit (E:\DropBox\p\jisageek\IoT\AlexaKNX\node_modules\aws-sdk\lib\sequential_executor.js:77:10)
    at Request.emit (E:\DropBox\p\jisageek\IoT\AlexaKNX\node_modules\aws-sdk\lib\request.js:682:14)
    at Request.transition (E:\DropBox\p\jisageek\IoT\AlexaKNX\node_modules\aws-sdk\lib\request.js:22:10)
    at AcceptorStateMachine.runTo (E:\DropBox\p\jisageek\IoT\AlexaKNX\node_modules\aws-sdk\lib\state_machine.js:14:12)
    at E:\DropBox\p\jisageek\IoT\AlexaKNX\node_modules\aws-sdk\lib\state_machine.js:26:10
    at Request.<anonymous> (E:\DropBox\p\jisageek\IoT\AlexaKNX\node_modules\aws-sdk\lib\request.js:38:9)
    at Request.<anonymous> (E:\DropBox\p\jisageek\IoT\AlexaKNX\node_modules\aws-sdk\lib\request.js:684:12)

Is that an error in the sdk or do I have to configure the trigger manually or is there another way to create a trigger programmatically?

Any advice is appreciated. Thanks!

joerg

2

2 Answers

0
votes

I haven't done what your trying before but a quick look at your error message shows that you've provided the wrong ARN.

Value 'amzn1.ask.skill.d9d9f7b1-f7d6-4050-a3d1-753e47e7038a' at 'eventSourceArn' 
failed to satisfy constraint: 
Member must satisfy regular  expression pattern: arn:(aws|aws-us-gov):([a-zA-Z0-9\-])+:([a-z]{2}(-gov)?-[a-z]+-\d{1})?:(\d{12})?:(.*)

The regular expression provided states your reference should start with "arn:" like those provided by Amazon Lambda.

For example your ARN from above

arn:aws:iam::1234567890:role/SmartHomeSkillRole

It appears you have provided your Alexa Skill Identifier as provided by the Alexa developer service.

amzn1.ask.skill.d9d9f7b1-f7d6-4050-a3d1-753e47e7038a

I would try swapping the EventSourceArn: with the Roll: or trying both as the arn value. - Hope this helps but like I said this is speculation from the information provided.

0
votes

When I'm trying to export the function with trigger (as package), it complains that the trigger is currently not supported. From that I deduct that the upload fails because of the lack of this particular support.

Trigger not supported

I really would like to see some progress here from AWS, because it's essential to bring Skill devlopment to some automation level. If one is tinkering around it might be fine, but for pro devs it's a mess...