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

fix(aws_lambda): update how context is extracted #5461

Merged

Conversation

duncanista
Copy link
Collaborator

@duncanista duncanista commented Apr 4, 2023

Handlers are allowed to have more than the two required positional arguments.

def handler(event, context, extra_arg, optional_arg=False):
    ...
    return ...

Our current context extraction checks for the last element. The patch didn't take into account that more arguments can be provided besides the two required. This PR fixes that.
It is guaranteed that the (event, context) arguments will be in the first positions.

Testing strategy

  • Updates tests to have extra arguments
  • Tested with an actual AWS Lambda too.

Checklist

  • Change(s) are motivated and described in the PR description.
  • Testing strategy is described if automated tests are not included in the PR.
  • Risk is outlined (performance impact, potential for breakage, maintainability, etc).
  • Change is maintainable (easy to change, telemetry, documentation).
  • Library release note guidelines are followed.
  • Documentation is included (in-code, generated user docs, public corp docs).
  • PR description includes explicit acknowledgement/acceptance of the performance implications of this PR as reported in the benchmarks PR comment.

Reviewer Checklist

  • Title is accurate.
  • No unnecessary changes are introduced.
  • Description motivates each change.
  • Avoids breaking API changes unless absolutely necessary.
  • Testing strategy adequately addresses listed risk(s).
  • Change is maintainable (easy to change, telemetry, documentation).
  • Release note makes sense to a user of the library.
  • Reviewer has explicitly acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment.

@duncanista duncanista requested review from a team as code owners April 4, 2023 00:27
@duncanista duncanista merged commit 883f685 into 1.x Apr 4, 2023
@duncanista duncanista deleted the jordan.gonzalez/fix-aws-lambda-get-argument-value-position branch April 4, 2023 19:40
@github-actions github-actions bot added this to the v1.12.0 milestone Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants