I wanted to add another variable to this object which as you can see is deeply nested.
const functionParams = {
handler,
runtime,
environment: {
variables: {
restrictedActions: config.restrictedActions
}
}
}
I achieved it like so:
const newFunctionParams = {...functionParams, environment: {
...functionParams.environment, variables: {
...functionParams.environment.variables,
APIAllowEndpoint: `https://severless....`,
APIDenyEndpoint: `https://severless....`,
TOPIC: topicArn
}
}}
The result:
{
handler,
runtime,
environment: {
variables: {
restrictedActions: config.restrictedActions,
APIAllowEndpoint: `https://severless....`,
APIDenyEndpoint: `https://severless....`,
TOPIC: topicArn
}
}
}
Credit to @chelmertz