serverless-aws-alias
serverless-aws-alias copied to clipboard
"'null' values are not allowed in templates" error for permissions when provider.versionFunctions is set to false
When provider.versionFunctions is set to false in the serverless.yml some nulls end up in the cloudformation-template-create-alias-stack.json
"DependsOn": [
null,
null
]
which results in the following error in deployment:
[/Resources/<FunctionName>LambdaPermissionApiGateway/DependsOn/0] 'null' values are not allowed in templates
If function versioning is required it would be great to have a more clear error message.
Hi @dancoates . Good catch 👍
You're absolutely right. The plugin depends on enabled function versioning, as otherwise no aliases can be used at all.
Maybe the best solution here would be to bail out very early, i.e. immediately in the beginning, if a provider.versionFunctions === false is detected.
Although another solution would be to silently enable versioning for the service and overwrite the property with true. But imo an error is better, because it let's the user know that the setting is needed.
@HyperBrain, I agree that an immediate exit with an error message which explicitly states that provider.versionFunctions needs to be set to true is the best approach to take.
I just came across this error and was surprised to see if was an expected case and had such a cryptic looking error message.