-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
feat(aws-lambda): add requestContext field into aws-gateway-compatible input #9380
Merged
fffonion
merged 5 commits into
Kong:master
from
windmgc:feat-lambda-plug-request-context
Oct 18, 2022
Merged
feat(aws-lambda): add requestContext field into aws-gateway-compatible input #9380
fffonion
merged 5 commits into
Kong:master
from
windmgc:feat-lambda-plug-request-context
Oct 18, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tieske
reviewed
Sep 6, 2022
-- Kong does not have the concept of stage, so we just let resource path be the same as path | ||
local resourcePath = path | ||
|
||
requestContext = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the locals, most are not used, we can add the values in-line to the table below?
(nitpick: feel free to ignore)
windmgc
force-pushed
the
feat-lambda-plug-request-context
branch
3 times, most recently
from
September 13, 2022 03:05
a833a1b
to
df5dad6
Compare
Tieske
approved these changes
Sep 19, 2022
windmgc
force-pushed
the
feat-lambda-plug-request-context
branch
from
October 18, 2022 06:18
df5dad6
to
55a6523
Compare
locao
pushed a commit
that referenced
this pull request
Jun 21, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a new field
requestContext
into the lambda input data when the aws-lambda plugin is working inawsgateway_compatible
mode.The
requestContext
is part of the input data in lambda proxy integration, according to this AWS document page, and it contains many fields containing request related information on AWS API Gateway.The aws-lambda plugin in Kong provides an AWS API Gateway compatible mode that can generate an input data similar with
the example provided in this doc, but it does not contain the
requestContext
field. When users are writing their lambda functions with some libraries like aws-serverless-java-container, it will check if the input data have therequestContext
field, and if it does not exist, the request will be regarded as malformed.(For example, see this code snippet)To make the input data sound more "compatible", this PR adds the
requestContext
field into the input data. Note that many fields in the formalrequestContext
cannot be fetched by Kong(like IAM-related information or Cognito-related auth info), so we're just providing a best-effort delivery here. We cannot make assurance that therequestContext
provided by Kong has every information that the lambda function needs, and it is decided by the lambda function whether the whole payload containingrequestContext
can work normally or not. So the feature is just a good-to-have one.Full changelog
requestContext
field intoawsgateway_compatible
input dataIssue reference
This should fix FTI-2620, and #7641, in some cases.