Skip to content

fix Events v2 APIGW target test and update snapshots #11633

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 1 commit into from
Oct 6, 2024

Conversation

bentsku
Copy link
Contributor

@bentsku bentsku commented Oct 3, 2024

Motivation

When running a new test in Events v2 with APIGW NG enabled, I've encountered test failures due to bad replacement in the snapshots (it would replace the HTTP value across the whole snapshot string, leading to very weird error in ResponseMetadata), see the run here: https://app.circleci.com/pipelines/github/localstack/localstack/28547/workflows/b21fae5b-918f-4356-8a18-51b324914127/jobs/249483

I've refactored the snapshot logic a bit in order to delete less information from it, for us to be able to validate some assumptions in the requestContext, and have a clear idea of what is wrong/need to be fixed in the snapshot via the skip_verify.

It showed that events will send specific headers to APIGW, like X-Amz-Source-Arn and X-Amz-Source-Account which might be used by the user's API Gateway integration. As a side-note, it also showed events is directly using the Java SDK to send/sign the requests 😄

Changes

  • update the transformers to use v1 lambda proxy transform instead of v2
  • added snapshot skips instead of transforming the whole problematic payload without replacement
  • updated the Python runtime used in the lambda

\cc @cloutierMat

@bentsku bentsku self-assigned this Oct 3, 2024
@bentsku bentsku requested review from gregfurman and removed request for Morijarti, joe4dev and maxhoheiser October 3, 2024 20:11
@bentsku bentsku added aws:apigateway Amazon API Gateway aws:events Amazon EventBridge semver: patch Non-breaking changes which can be included in patch releases labels Oct 3, 2024
Copy link

github-actions bot commented Oct 3, 2024

LocalStack Community integration with Pro

    2 files      2 suites   1h 1m 47s ⏱️
1 968 tests 1 770 ✅ 198 💤 0 ❌
1 970 runs  1 770 ✅ 200 💤 0 ❌

Results for commit 9af0725.

Copy link
Member

@maxhoheiser maxhoheiser left a comment

Choose a reason for hiding this comment

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

Great catch and thank you for fixing this looks not so easy to figure out what to replace exactly for the new APIGW 👍

@bentsku bentsku merged commit dcf4fcf into master Oct 6, 2024
47 of 48 checks passed
@bentsku bentsku deleted the fix-event-apigw-test branch October 6, 2024 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws:apigateway Amazon API Gateway aws:events Amazon EventBridge 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