I'm formatting my parameters according to this https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Greengrass.html#createFunctionDefinition-property
But for whatever reason its giving me a key error when for "Execution" as well as 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-
and the code
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;
};
I think that the issue is that the configuration data specifies two mutually exclusive options. There is a memory size value specified AND it says it should use "NoContainer". When the Greengrass container isn't in use memory size isn't a valid option.
Try removing memory size and see if that fixes it.
The provisioning code I've shared on Github "scrubs" functions when NoContainer is set to get around this issue. The scrubbing process is to set the memory size to NULL so when it is serialized to JSON the field is missing.