Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't have dot in custom variable's key - could not be found. #4652

Closed
ozbillwang opened this issue Jan 13, 2018 · 5 comments
Closed

Can't have dot in custom variable's key - could not be found. #4652

ozbillwang opened this issue Jan 13, 2018 · 5 comments

Comments

@ozbillwang
Copy link

ozbillwang commented Jan 13, 2018

This is a (Bug Report / Feature Proposal)

Description

For bug reports:

  • What went wrong?

If the variable in custom has dot, serverless will always report could not be found.

  • What was the config you used?
$ cat dev.yml
version:
  v1.0: value-1
  v2.0: value-2

When I reference the variable ${self:custom.version.v1.0}, always got the error:

could not be found.

I understand that custom variable use dot (.) as splitter, but how to escape dot when reference it?

@ozbillwang
Copy link
Author

ozbillwang commented Jan 13, 2018

Ok, I fixed it by myself. Escape with backslash.

${self:custom.version.v1\.0}

@ozbillwang
Copy link
Author

ozbillwang commented Jan 14, 2018

Above way (escape dot) can pass cloudformation validate, but can't be deployed.

Invalid HTTP endpoint specified for URI.

If serverless print, I can't see the variable is replaced by the real value, and in updated CFN,

"${self:custom.version.v1\\.0}"

@rupakg
Copy link
Contributor

rupakg commented Jan 15, 2018

Can you just use v1_0 instead of a . ?

@HyperBrain
Copy link
Member

@ozbillwang There is currently no escape syntax for Serverless variable names, i.e. it is not possible to use dots in names for other things than separating subobjects.
Although it seems like a corner case for me, I agree that this would be an useful enhancement for these cases.

@ozbillwang
Copy link
Author

Thanks, @rupakg @HyperBrain

At the moment, I use other characters to replace dot for these keys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants