serverless-graphql-nodejs-starter
serverless-graphql-nodejs-starter copied to clipboard
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.
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
Hey @daniulChowdhury , have you managed to come right with this issue?
same here
@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}
.
@AmoDinho
Solve this bug with the config below.
provider:
stage: dev
custom:
stage: ${opt:stage, self:provider.stage}
However, several successive errors are happening.
@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 🦖