question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trying to populate non string value into a string for variable

See original GitHub issue

This is a (Bug Report)

Description

  • What went wrong? I updated to the latest version of Serverless and I’m now getting an error when I invoke functions locally without adding the stage option in the command line.
  • What did you expect should have happened? The function should have been executed without an issue using the default stage as it was set up in the serverless.yml
provider:
  name: aws
  stage: dev
  custom:
    stage: ${opt:stage, self:provider.stage}
  • What was the config you used?
     OS:                 darwin
     Node Version:       6.10.3
     Serverless Version: 1.14.0
  • What stacktrace or error message from your provider did you see?
 Serverless Warning --------------------------------------
 
     A valid option to satisfy the declaration 'opt:stage'
     could not be found.
 
 
  Serverless Error ---------------------------------------
 
     Trying to populate non string value into a string for
     variable ${opt:stage}. Please make sure the value of
     the property is a string.
 
  Stack Trace --------------------------------------------
 
ServerlessError: Trying to populate non string value into a string for variable ${opt:stage}. Please make sure the value of the property is a string.
    at Variables.populateVariable (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:143:17)
    at singleValueToPopulate.then.valueToPopulate (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:109:23)
    at process._tickDomainCallback (internal/process/next_tick.js:135:7)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:9
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

11reactions
jliebrandcommented, Jun 8, 2017

Ok “fixed” this… the config command I was running doesn’t need a --stage but the way I had set up my yml meant it would complain if it’s not there…

So I added --stage to the config command which fixed things…

8reactions
connor11528commented, Apr 3, 2020

I’m new to serverless and just got this same error when trying to login. Is there a fix here or something I need to configure to login and run deployments?

$ serverless login

 Serverless Warning --------------------------------------

  A valid option to satisfy the declaration 'opt:stage' could not be found.


  Serverless Error ---------------------------------------

  Trying to populate non string value into a string for variable ${opt:stage}. Please make sure the value of the property is a string.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              8.9.1
     Framework Version:         1.67.0
     Plugin Version:            3.6.3
     SDK Version:               2.3.0
     Components Version:        2.28.0
Read more comments on GitHub >

github_iconTop Results From Across the Web

Trying to populate non string value into a string for variable
This usually happens when the value is a reference instead of a string, and the reference resolves to a non-string, ie. usually undefined...
Read more >
AWS Serverless, CloudFormation : Error, Trying to populate ...
Trying to populate non string value into a string for variable ${self:custom.accountId}. Please make sure the value of the property is a ...
Read more >
Error, Trying to populate non string value into a string for ...
I am using serverless framework for deploying my application on AWS Cloud. I want to use the value of AWS Account ID in...
Read more >
Serverless error trying to populate non string value into a ...
Serverless error trying to populate non string value into a string for variable. Please make sure the value of the property is a...
Read more >
serverless/serverless - Gitter
I get the error : Trying to populate non string value into a string for variable ${file(./config/dev.yml)}. Please make sure the value of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found