Note: This report was initially about throwing an error if non existing file is referenced in a variable. It was updated to cover all failed variable resolution cases
Ideally we should fail unconditionally whenever resolution of a variable from a source crashes.
Note that fallbacks should be applied if no value was resolved (null or undefined), but not when resolution crashes.
Cases it should cover (by variables scope):
file: Pointing non existing file
cf, s3, ssm: Inability to retrieve the data (network or authentication error)
env: Not set environment variable
Proposed implementation
- Introduce a configuration option:
unresolvedVariablesNotificationMode with two possible options 'warn' (default) and 'error' (In v2 we will make 'error' a default)
- Throw on unresolved variables if
unresolvedVariablesNotificationMode is set to 'error'
- Introduce a following deprecation log if there are unresolved variables in a service, and service configuration doesn't contain
unresolvedVariablesNotificationMode:
Unresolved variable references will be communicated with a thrown error, starting from next major
See https://github.com/serverless/serverless/blob/master/CONTRIBUTING.md#configuring-deprecations for info on how to configure deprecations
Note: This report was initially about throwing an error if non existing file is referenced in a variable. It was updated to cover all failed variable resolution cases
Ideally we should fail unconditionally whenever resolution of a variable from a source crashes.
Note that fallbacks should be applied if no value was resolved (
nullorundefined), but not when resolution crashes.Cases it should cover (by variables scope):
file: Pointing non existing filecf,s3,ssm: Inability to retrieve the data (network or authentication error)env: Not set environment variableProposed implementation
unresolvedVariablesNotificationModewith two possible options'warn'(default) and'error'(In v2 we will make'error'a default)unresolvedVariablesNotificationModeis set to'error'unresolvedVariablesNotificationMode:See https://github.com/serverless/serverless/blob/master/CONTRIBUTING.md#configuring-deprecations for info on how to configure deprecations