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.

Local Deployment of api-gateway does not respect stage variables

See original GitHub issue

If I define stage variables for the api-gateway like so:

Type: AWS::Serverless::Api
    Properties:
      StageName: dev
      TracingEnabled: True
      Variables:
        logging : debug

And I deploy in AWS i get the following in the lambda api event:

"stageVariables": {
        "logging": "debug"
    },

However if i deploy for local test. I only get:

"stageVariables": null,

The local deployment is not respecting the stageVariables which breaks any application which requires them.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
hawflaucommented, Oct 18, 2021

Correction - stageVariables is also available in the local Lambda event for HTTP API if stageVariables property is set. Note that, in REST API, the property to stage variables is Variables. But in HTTP API, the property is StageVariables. It can be set under Globals as well.

@owen We are reviewing another PR which fixes some missing required fields in the requestContext in HTTP API Lambda event. That should fix the powertools issue you mentioned.

0reactions
github-actions[bot]commented, Oct 19, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting up stage variables for a REST API deployment
Stage variables are name-value pairs that you can define as configuration attributes associated with a deployment stage of a REST API.
Read more >
Stage variable with lambda - Amazon API Gateway p18
Welcome to part 18 of the tutorial series on Amazon API Gateway. ... or the lambda backend integration with respect to the stage...
Read more >
How to use API Gateway stage variables to call ... - YouTube
... variables to call specific Lambda alias?http://opensourceforgeeks.blogspot.com/2018/09/how-to-use- api - gateway - stage - variables.html.
Read more >
Setting stage variables using the Amazon API Gateway console
In this tutorial, you learn how to set stage variables for two deployment stages of a sample API by using the Amazon API...
Read more >
Deploying AWS Lambda Code In Different Environments
Deploy the API gateway to both the created stages for respective environments. After completing the above steps, you will require the respective ......
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