Skip to content

Difference between the routeKey in event object GET /projects/<id> on local vs GET /projects/{id} on AWS  #3463

@samaybhavsar

Description

@samaybhavsar

Description:

I created a project using SAM CLI v1.33.0 with Runtime: nodejs14.x. When running on my local machine using sam local start-api the routeKey in event object has angle brackets e.g. GET /projects/ while after deploying on AWS the routeKey in event object has curly brackets e.g. GET /projects/{id} . I am using the routeKey for access control.

Another similar issue which I noticed is, when running local I get "queryStringParameters": {}, (key with blank object) while after deploying to AWS, the key is not present.

Steps to reproduce:

  • Create a sample project using sam init
  • Set up an API endpoint with custom field in URL. e.g. project/{project_id}
  • Deploy the same to AWS
  • Compare event object for both

Observed result:

  • routeKey has angle brackets instead of curly brackets
  • "queryStringParameters": {}, on local but when deployed on AWS, this key is missing

Expected result:

Should have curly brackets in routeKey

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: Windows 10
  2. sam --version: 1.33.0
  3. AWS region: ca-central-1

Add --debug flag to command you are running

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions