"provider.stage" property is not accessible -- what's changed?

Pretty much since day one of the Serverless Framework I manage deploys to stage and prod by passing in an environment variable to serverless.yml

  name: aws
  region: ${env:AWS_LAMBDA_REGION}
  stage: ${env:AWS_STAGE}
  runtime: nodejs14.x

Now I am getting errors

Cannot resolve serverless.yml: “provider.stage” property is not accessible (configured behind variables which cannot be resolved at this stage)

Of course we are discovering this as we are about to deploy an extensive update to our product.

Has anyone else seen this error? Any ideas for resolution?

It’s because new variable resolver ensures that given properties are resolved before are actually used by internals.

We’re discussing it in more detal here: Environment variable in serverless.yml throws "Cannot resolve ..." error · Issue #9813 · serverless/serverless · GitHub

1 Like

Odd, but I wasn’t getting GitHub notifications. I have responded.

So what is the accepted fix for this matter?