Chris Laplante
06/01/2022, 2:04 AMFrank
import { Skill } from "./Skill";
const fn = new sst.Function(this, 'SkillFn', { ... });
const skill = new Skill(this, 'Skill', {
endpointLambdaFunction: fn,
skillPackagePath: 'src/skill-package',
alexaVendorId,
lwaClientId,
lwaClientSecret,
lwaRefreshToken,
});
Frank
sst.Function
to use Live Lambda Dev.Frank
Chris Laplante
06/01/2022, 2:26 AMChris Laplante
06/01/2022, 2:29 AMFrank
sls package
, and look at the AWS resources in the CFN template.Frank
Chris Laplante
06/01/2022, 2:36 AMChris Laplante
06/01/2022, 2:37 AMservice: aws-node-project
frameworkVersion: '3'
provider:
name: aws
runtime: nodejs14.x
functions:
hello:
handler: handler.hello
events:
- alexaSkill: amzn1.ask.skill.xx-xx-xx-xx-xx
Chris Laplante
06/01/2022, 2:38 AM"HelloLambdaPermissionAlexaSkill1": {
"Type": "AWS::Lambda::Permission",
"Properties": {
"FunctionName": {
"Fn::GetAtt": [
"HelloLambdaFunction",
"Arn"
]
},
"Action": "lambda:InvokeFunction",
"Principal": "<http://alexa-appkit.amazon.com|alexa-appkit.amazon.com>",
"EventSourceToken": "amzn1.ask.skill.xx-xx-xx-xx-xx"
}
}
Frank
import * as iam from "aws-cdk-lib/aws-iam";
const fn = new sst.Function(stack, "SkillFn", { ... });
fn.addPermission('Skill Invocation', {
principal: new iam.ServicePrincipal('<http://alexa-appkit.amazon.com|alexa-appkit.amazon.com>'),
eventSourceToken: "amzn1.ask.skill.xx-xx-xx-xx-xx",
});
Frank
Chris Laplante
06/01/2022, 2:52 AMFrank
Chris Laplante
06/01/2022, 2:59 AMChris Laplante
06/01/2022, 3:00 AMChris Laplante
06/01/2022, 3:01 AMFrank
Chris Laplante
06/01/2022, 3:08 AMError: There was a problem transpiling the Lambda handler: ✘ [ERROR] Could not resolve "axios"
backend/functions/lib/lwa.ts:4:18:
4 │ import axios from "axios";
╵ ~~~~~~~
You can mark the path "axios" as external to exclude it from the bundle, which will remove this error.
Chris Laplante
06/01/2022, 3:11 AMFrank
backend/package.json
should work.Frank
srcPath
set to backend
in index.ts
or for individual functions?Chris Laplante
06/01/2022, 3:18 AMChris Laplante
06/01/2022, 3:20 AMFrank
Chris Laplante
06/01/2022, 3:22 AMFrank