Silver
Silver

Reputation: 5081

Is it possible to pass an API Gateway variable into a Lambda Context?

I'd quite like to be able to use context.stage in a Lambda call, passed in from the API gateway context - but I can only see how to put it into the message body (event object). Is there any way to add arbitrary information to the Lambda Context?

Upvotes: 3

Views: 1198

Answers (1)

Michael Goin
Michael Goin

Reputation: 416

I believe your only option is to add it to the event. You can always extract the value at the start of your Lambda function and then delete the property.

The Rest API example from AWS does something similar:

var operation = event.operation;
delete event.operation;

Upvotes: 4

Related Questions