Skip to content

ESM v2: Allow target Lambda response payloads to not only be JSON #11661

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

Merged
merged 2 commits into from
Oct 10, 2024

Conversation

gregfurman
Copy link
Contributor

Motivation

This PR accounts for the case where an invoked Lambda with an Event Source Mapping is invalid JSON.

Changes

  • Checks if a payload from an invocation fails to be decoded into JSON, setting the payload value to None if an exception is raised.
  • Add some testing for when no value is returned by a Lambda.

TODO

What's left to do:

  • Update EventSourceMapping configuration to relfect additional EventSourceMappingArn field -- since our current ESM parity tests cannot be extended to account for the above case.

Copy link

github-actions bot commented Oct 9, 2024

LocalStack Community integration with Pro

    2 files  ±  0      2 suites  ±0   1h 20m 21s ⏱️ - 22m 6s
2 564 tests  - 924  2 248 ✅  - 827  316 💤  - 97  0 ❌ ±0 
2 566 runs   - 924  2 248 ✅  - 827  318 💤  - 97  0 ❌ ±0 

Results for commit 544333e. ± Comparison against base commit 3ff3e2a.

This pull request removes 928 and adds 4 tests. Note that renamed tests count towards both.
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_lambda_dynamodb
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_opensearch_crud
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_search_books
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_setup
tests.aws.scenario.kinesis_firehose.test_kinesis_firehose.TestKinesisFirehoseScenario ‑ test_kinesis_firehose_s3
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_destination_sns
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_infra
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_prefill_dynamodb_table
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input0-SUCCEEDED]
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input1-SUCCEEDED]
…
tests.aws.services.lambda_.test_lambda.TestLambdaFeatures ‑ test_invocation_type_no_return_payload[nodejs-Event]
tests.aws.services.lambda_.test_lambda.TestLambdaFeatures ‑ test_invocation_type_no_return_payload[nodejs-RequestResponse]
tests.aws.services.lambda_.test_lambda.TestLambdaFeatures ‑ test_invocation_type_no_return_payload[python-Event]
tests.aws.services.lambda_.test_lambda.TestLambdaFeatures ‑ test_invocation_type_no_return_payload[python-RequestResponse]

@gregfurman gregfurman self-assigned this Oct 10, 2024
@gregfurman gregfurman added aws:lambda AWS Lambda semver: patch Non-breaking changes which can be included in patch releases labels Oct 10, 2024
@gregfurman gregfurman added this to the 4.0 milestone Oct 10, 2024
@gregfurman gregfurman marked this pull request as ready for review October 10, 2024 08:41
Copy link
Member

@dfangl dfangl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Let's tackle explicit testing in a follow up

@gregfurman gregfurman merged commit 67f5698 into master Oct 10, 2024
38 of 39 checks passed
@gregfurman gregfurman deleted the fix/esm/empty-invoke-payload branch October 10, 2024 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws:lambda AWS Lambda semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants