1

我正在根据此https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Greengrass.html#createFunctionDefinition-property格式化我的参数

但无论出于何种原因,它在“执行”和 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;

                                    };
4

1 回答 1

1

我认为问题在于配置数据指定了两个互斥选项。指定了一个内存大小值并且它说它应该使用“NoContainer”。当 Greengrass 容器未使用时,内存大小不是有效选项。

尝试删除内存大小,看看是否可以解决它。

当 NoContainer 设置为解决此问题时,我在 Github“scrubs”上共享的配置代码功能。清理过程是将内存大小设置为 NULL,因此当它被序列化为 JSON 时,该字段会丢失。

https://github.com/awslabs/aws-greengrass-provisioner/blob/e2608654b65682ca9b5b03da962cc8cb29ea1cbf/src/main/java/com/awslabs/aws/greengrass/provisioner/implementations/helpers/BasicGreengrassHelper.java#L390

于 2019-02-12T20:51:57.203 回答