Search code examples
amazon-web-servicesserverlessserverless-frameworkaws-serverless

Serverless framework Variable dependency failure


I am trying to run a bash script that calls the serverless framework's deploy command, to create AWS resources,
The deploy command passes parameters, which are to be referred to in the serverless.yaml file

My command is like - serverless deploy --param=deploymentRegion=us-east-1

While in the serverless.yaml, I am trying to use the passed parameter like -
region: ${param:deploymentRegion}

I am getting the following error -

Exception -----------------------------------------------
 
  "Variable dependency failure: variable 'param:deploymentRegion' references Serverless Parameters but using that service requires a concrete value to be called."
 
     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com
 
  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              16.16.0
     Framework Version:         1.54.0
     Plugin Version:            3.1.2
     SDK Version:               2.1.2
     Components Core Version:   1.1.1
     Components CLI Version:    1.4.0

I am trying to refer -
https://www.serverless.com/framework/docs/guides/parameters

What am I doing wrong?


Solution

  • the problem in your case is that you're using a heavily outdated version of the Framework. The params functionality was introduced in v3 release, and you're on v1.54.0 which is no longer supported. Upgrading should do the trick, but you need to be careful and first upgrade to v2 and then to v3.