A validation error is thrown when nesting a variable using a custom variable syntax.
This error was discovered when I tried to nest a variable inside a cloud formation reference as such: ${{cf:other-stack-${{self:provider.stage}}.Resource}}
. The custom variable syntax used is shown in the serverless.yml file below.
service: addon
provider:
name: aws
runtime: python2.7
stage: prod
region: us-west-2
profile: security
versionFunctions: false
variableSyntax: '\${{([\s\S]+?)}}'
plugins:
- serverless-package-python-functions
package:
individually: true
custom:
test: ${{cf:core-${{self:provider.stage}}.multiStackCore}} # Error thrown here
pkgPyFuncs:
buildDir: build
The error thrown is
Serverless Error ---------------------------------------
1 validation error detected: Value 'core-${{self' at 'stackName' failed to satisfy constraint: Member must satisfy regular expression pattern: [a-zA-Z][-a-zA-Z0-9]*|arn:[-a-zA-Z0-9:/._+]*
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Forums: forum.serverless.com
Chat: gitter.im/serverless/serverless
Your Environment Information -----------------------------
OS: darwin
Node Version: 7.8.0
Serverless Version: 1.18.1
This error does not occur when the default variable syntax is used.
@ubaniabalogun
It seems that variableSyntax
which you specify would go wrong.
I have updated variableSyntax syntax to variableSyntax: "\\${{([ :a-zA-Z0-9._,\\-\\/\\(\\)]+?)}}"
on my laptop and comfirmed sls deploy
is successful.
Could you please try a fix like this?
@horike37 This fix worked! Thanks!
@horike37 This fix worked! Thanks!
@ubaniabalogun great! Glad to hear that @horike37 provided the correct variableSyntax
to fix that.
Thanks @horike37 for helping out! 👍
Most helpful comment
@horike37 This fix worked! Thanks!