我正在根据此https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Greengrass.html#createFunctionDefinition-property格式化参数
但是无论出于何种原因,它在执行“ Execution”以及DefaultConfig时给我一个关键错误
Response:
Request ID:
"3ed83472-39af-493b-9df7-7f82d2f14636"
Function Logs:
r: Unexpected key \'Execution\' found in params.InitialVersion.Functions[0].FunctionConfiguration.Environment',
code: 'MultipleValidationErrors',
errors:
[ { UnexpectedParameter: Unexpected key 'DefaultConfig' found in params.InitialVersion
at ParamValidator.fail (/var/runtime/node_modules/aws-
和代码
GG.createFunctionDefinition({
InitialVersion: {
DefaultConfig: {
Execution: {
IsolationMode: "NoContainer"}
},
Functions: [
{
FunctionArn: "arn:aws:lambda:us-west-2:644226108543:function:SahmCumminsTelemetryTest:1",
FunctionConfiguration: {
MemorySize: 524288,
Pinned: true,
Timeout: 600,
Environment: {
AccessSysfs: false,
Execution: {
IsolationMode: "NoContainer",
RunAs: {
Gid: 0,
Uid: 0
}
}
}
},
Id: "function_definition",
},
],
},
Name: "function_definition",
}, function (err, data) {
if (err) {
console.log(err, err.stack);
}
else {
funcArn = data.LatestVersionArn;
};
最佳答案
我认为问题在于配置数据指定了两个互斥的选项。指定了一个内存大小值,并说应该使用“ NoContainer”。如果不使用Greengrass容器,则内存大小不是有效的选择。
尝试删除内存大小,看看是否可以解决。
当设置NoContainer来解决此问题时,我在Github上共享的配置代码会“擦洗”功能。清理过程是将内存大小设置为NULL,因此当序列化为JSON时,该字段丢失。
https://github.com/awslabs/aws-greengrass-provisioner/blob/e2608654b65682ca9b5b03da962cc8cb29ea1cbf/src/main/java/com/awslabs/aws/greengrass/provisioner/implementations/helpers/BasicGreengrassHelper.java#L390
关于javascript - AWS Javascript SDK:Greengrass createFunctionDefinition,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/54370643/