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

Serverless Error: Trying to populate non string value into a string for variable ${self:custom.stage}. Please make sure the value of the property is a string. #16

Open
daniulChowdhury opened this issue Dec 27, 2020 · 5 comments

Comments

@daniulChowdhury
Copy link

Screen Shot 2020-12-27 at 10 57 06 pm

Hi Amo,

I encounter this issue as I follow the instructions from your tutorial: https://fsgql.com/set-up-seed

Do you have any advice on how to solve this?

Regards,

Daniul

@AmoDinho
Copy link
Contributor

Hey @daniulChowdhury , have you managed to come right with this issue?

@wagnercsfilho
Copy link

same here

@AmoDinho
Copy link
Contributor

@wagnercsfilho

This usually happens when ${self:custom.stage} is not defined in your serverless.yml. Make sure you have stage defined under the custom block, something like this:

custom:
  stage: ${opt:stage, self:provider.stage}

If you don't already have a custom block in your serverless.yml, add it to your serverless.yml above the provider block. If you do already have one, add the stage: ${opt:stage, self:provider.stage} to the block.

Be sure to watch out for indention. There are no spaces before custom:, and two spaces before stage: ${opt:stage, self:provider.stage}.

@wagnercsfilho
Copy link

@AmoDinho

Solve this bug with the config below.

provider:
  stage: dev
custom:
  stage: ${opt:stage, self:provider.stage}

However, several successive errors are happening.

Captura de Tela 2021-02-18 às 15 14 44

Captura de Tela 2021-02-18 às 15 14 36

@AmoDinho
Copy link
Contributor

@wagnercsfilho Bruv, can you make sure your serverless.yml looks like this:

service: lunar-tour-api

# Use the serverless-webpack plugin to transpile ES6
plugins:
  - serverless-bundle
  - serverless-offline
  - serverless-dotenv-plugin

# serverless-webpack configuration
# Enable auto-packing of external modules
custom:
  stage: ${opt:stage, self:provider.stage}
  region: ${opt:region, self:provider.region}

  serverless-offline:
    port: 4000
  bundle:
    linting: false

provider:
  name: aws
  runtime: nodejs12.x
  stage: dev
  region: us-east-1


functions:
  graphql:
    handler: src/graphql.graphqlHandler
    environment:
      SLS_DEBUG: true
    events:
      - http:
          path: graphql
          method: post
          cors: true
          integration: lambda-proxy

      - http:
          path: graphql
          method: get
          cors: true
          integration: lambda-proxy



Please let me know how it goes 🦖

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