Alexa的谷歌助手技能



我找到了一份关于如何为Alexa创建技能的指南,该指南使我将谷歌用作搜索引擎(从而将谷歌助手集成到Alexa中(。问题是,亚马逊已经升级到nodejs 16.x,而指南则停留在以前的版本上。我该如何解决这个问题?

在亚马逊AWS上使用Lambda运行测试,它给我的错误如下:

{
"errorMessage": "RequestId: ab04002d-67e6-4144-9c1f-94987a0b8e5e Error: Runtime exited with error: exit status 7",
"errorType": "Runtime.ExitError"
}
nNODE_MODULE_VERSION 72. This version of Node.js requiresnNODE_MODULE_VERSION 93. Please try re-compiling or re-installingnthe module (for instance, using `npm rebuild` or `npm install`).","code":"ERR_DLOPEN_FAILED","stack":["Error: The module '/var/task/node_modules/@suldashi/lame/build/Release/bindings.node'","was compiled against a different Node.js version using","NODE_MODULE_VERSION 72. This version of Node.js requires","NODE_MODULE_VERSION 93.

我想我需要通过上传更新的zip文件来修改Lambda函数代码,但我不知道如何或在哪里获得它

例如,我上传了这个zip文件(github:https://github.com/rokmohar/alexa-assistant/releases)以将Node更新到12.x版本并更新Node包。有可能用nodejs 16.x做类似的事情吗?

我相信问题出在这个代码上:

{
"AWSTemplateFormatVersion": "2010-09-09",
"Metadata":{
"License": "Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License"
},
Description: "This AWS CloudFormation Template is provided for users to install the Alexa Google Assistant skill. It is provided under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. This means that you may use this template provided that it is not for commercial use. You may not host instructions that use this CloudFormation template if you receive monetisation from that page, for example embedded adverts",
"Mappings": {
"RegionMap": {
"us-east-1": {
"BUCKET": "alexagoogleassistantskilluseast1"
},
"eu-west-1": {
"BUCKET": "alexagoogleassistantskilleuwest1"
}
}
},
"Conditions": {
"CorrectAWSRegion": {
"Fn::Or": [
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"eu-west-1"
]
},
{
"Fn::Equals": [
{
"Ref": "AWS::Region"
},
"us-east-1"
]
}
]
},
"IncorrectAWSRegion": {
"Fn::Not": [
{
"Condition": "CorrectAWSRegion"
}
]
}
},
"Resources": {
"S3Bucket": {
"Type": "AWS::S3::Bucket",
"Condition": "CorrectAWSRegion",
"Properties": {

}
},
"DynamoDBtable": {
"Type" : "AWS::DynamoDB::Table",
"Condition": "CorrectAWSRegion",
"Properties" : {
"AttributeDefinitions" : [
{
"AttributeName" : "userId",
"AttributeType" : "S"   
}
],
"KeySchema" : 
[
{
"AttributeName" : "userId",
"KeyType" : "HASH"
}
]

,
"ProvisionedThroughput" : {
"ReadCapacityUnits" : 5,
"WriteCapacityUnits" : 5
},
"TableName": "AlexaAssistantSkillSettings"                       
}

},
"LambdaFunctionRole": {
"Type": "AWS::IAM::Role",
"Condition": "CorrectAWSRegion",
"Properties": {
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": [
"lambda.amazonaws.com"
]
},
"Action": [
"sts:AssumeRole"
]
}
]
},
"Path": "/",
"Policies": [
{
"PolicyName": "GoogleAssistantPolicy",
"PolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowLogging",
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": [
"*"
]
},
{
"Effect": "Allow",
"Action": "s3:*",
"Resource": [
{
"Fn::Join": [
"",
[
{
"Fn::GetAtt": [
"S3Bucket",
"Arn"
]
},
"*"
]
]
}
]
},
{
"Effect": "Allow",
"Action": "dynamodb:*",
"Resource": [
{
"Fn::Join": [
"",
[
{
"Fn::GetAtt": [
"DynamoDBtable",
"Arn"
]
},
"*"
]
]
}
]
}

]
}
}
]
}
},
"AlexaSkillFunction": {
"Type": "AWS::Lambda::Function",
"Condition": "CorrectAWSRegion",
"Properties": {
"FunctionName": "alexa-assistant-skill-function",
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"LambdaFunctionRole",
"Arn"
]
},
"Description": "Alexa Skill code for the Google Assistant Skill",
"Code": {
"S3Bucket": {
"Fn::FindInMap": [
"RegionMap",
{
"Ref": "AWS::Region"
},
"BUCKET"
]
},
"S3Key": "index_1.2.zip"
},
"Runtime": "nodejs16.x",
"Timeout": "10",
"MemorySize": "1344",
"Environment": {
"Variables": {
"S3_BUCKET": {
"Ref": "S3Bucket"
},
"API_ENDPOINT": "embeddedassistant.googleapis.com"
}
}
}
},
"AlexaSkillFunctionPermissions": {
"Type": "AWS::Lambda::Permission",
"Condition": "CorrectAWSRegion",
"Properties": {
"FunctionName": {
"Ref": "AlexaSkillFunction"
},
"Action": "lambda:InvokeFunction",
"Principal": "alexa-appkit.amazon.com"
}
}
},
"Outputs": {
"FunctionARN": {
"Condition": "CorrectAWSRegion",
"Value": {
"Fn::GetAtt": [
"AlexaSkillFunction",
"Arn"
]
},
"Description": "Lambda function ARN to be placed in the Amazon Developer Portal"
},
"FunctionError": {
"Condition": "IncorrectAWSRegion",
"Value": "Incorrect AWS Region!!! Must be US-East(N. VIRGINIA) or EU(Ireland)",
"Description": "You must Select US-EAST (North Virgina) if you are located in North America or EU (Ireland) if you are located elsewhere"
}
}

}

谢谢你的帮助。

我是上面包的管理员。它刚刚更新为使用NodeJs18.x和最新的ASK SKD v2。你能试着用最新版本(目前是1.5.0(进行设置吗?让我知道它是否适合你。

最新更新