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

Payload for Lambda, from APIGatewayProxyRequest object (works in node) #120

Closed
ShaneGMamet opened this issue May 17, 2017 · 3 comments
Closed
Labels
feature-request A feature should be added or improved.

Comments

@ShaneGMamet
Copy link

ShaneGMamet commented May 17, 2017

I have a query on what should have been something really simple.

We have a need for writing our Lambda in .Net Core (C#) which is using a API Gateway resource and were trying to get custom variables created either from the Custom Authorizer or directly from the body mapping template attached to the API Gateway's resource (on the Integration Request).

The problem we ran into was that through node you can access the 'event' parameter which would contain the entire json payload, meaning you could get your new custom variable like so:
event.requestContext.authorizer.customKey or event.requestContext.context.customKey.

The problem is that there is no way to get these variables from within the C# code, using the [APIGatewayProxyRequest] request object. I have chatted with some engineers from AWS (we have a business plan), who have confirmed (after 3 or 4 people go involved) that there is no obvious or possible way of getting this entire payload from the request object for interrogation, through C#.

This was a problem with our particular case, as we could then, not access the any custom variables, meaning we need to change plans.

I find it really strange how it can be achievable within node but not catered for in C#?

A Stack Overflow question what would help with an example, can be found here:
http://stackoverflow.com/questions/43990385/aws-lambda-c-sharp-accessing-custom-context

Can this be confirmed?

@normj

@normj
Copy link
Member

normj commented May 18, 2017

Yes, we do need to expand APIGatewayProxyRequest to get access to the custom authorizer.

A work around till then is have your Lambda function take in a System.IO.Stream instead of APIGatewayProxyRequest. Then you have access to the original JSON which you can parse yourself. You can grab the information you need from that JSON and then deserialize JSON to APIGatewayProxyRequest as well.

@normj
Copy link
Member

normj commented Aug 24, 2017

Closing is this is a duplicate of #98

@normj normj closed this as completed Aug 24, 2017
@diehlaws diehlaws added feature-request A feature should be added or improved. and removed Enhancement labels Jan 3, 2019
@abhijeetkharkar
Copy link

has this feature been added? if yes, could i get a link to some documentation around it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

4 participants