Variable resolves to ${deep:0}

Hey everyone!

I have a weird problem with variables:

  bucketName: myservice-${self:provider.stage}-storage
  dashboardName: myservice-${self:provider.stage}

The bucketName variable is used as an environment var on a function:

  S3_BUCKET_NAME: ${self:custom.bucketName}

The problem is, the variable ${self:custom.bucketName} is resolved to ${deep:0}. While the other variable (dashboardName) is properly resolved.

I should note, that I have variableSyntax set:

variableSyntax: "\\${((env|self|opt|file|cf|s3)[:\\(][ :a-zA-Z0-9._,\\-\\/\\(\\)]*?)}"

But considering that the other variable got resolved correctly, I doubt that this is the problem. Any idea what is going on?

I am running version 1.74.1

Okay, the difference between those two variables is, that dashboardName is resolved in the Resources block. If I use it for an environment variable of a function, then I get the same problem with ${deep:X}.

So it is actually because of the variableSyntax. But how would I fix that?

Posted this on github and got a solution (

Extending the variableSyntax regex to include deep solved the issue:
variableSyntax: "\\${((env|self|opt|file|cf|s3|deep)[:\\(][ :a-zA-Z0-9._,\\-\\/\\(\\)]*?)}"