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

AWS Lambda Integration Not Logging Payload #4011

Open
paulthorburn opened this issue Jan 31, 2025 · 3 comments
Open

AWS Lambda Integration Not Logging Payload #4011

paulthorburn opened this issue Jan 31, 2025 · 3 comments

Comments

@paulthorburn
Copy link

How do you use Sentry?

Sentry Saas (sentry.io)

Version

2.20.0

Steps to Reproduce

According to this document https://docs.sentry.io/platforms/python/integrations/aws-lambda/manual-instrumentation/

Request data including HTTP method, URL, headers, form data, and JSON payloads will be attached to all events.

but i have run several tests and the payload is not being caputred

Overview:
Step 1 - Create a Lambda Function
Step 2 - Send events from different sources

TEST 1: AWS Console

  • Create Lambda, Hit Test button
    Image

TEST 2: API Gateway

  • Create Lambda, Create API Gateway, Create Proxy Integration Between API Gateway and Lambda
  • Send a POST request to API Gateway
    Image

TEST 3: Lambda Function URL

  • Create Lambda, go to Configuration, go to Lambda URL and enable
  • Make a POST request to the Function URL
    Image

Test 4: S3 Event Notification

  • Create Lambda, Create S3 Bucket
  • In S3 bucket under Event notifications point it to the Lambda
  • Upload File to S3 Bucket
    Image

Test 5: Event Bridge Notifications

  • Create Lambda, Create S3 Bucket
  • In S3 bucket under Amazon EventBridge click enable
  • In EventBridge under the "default" event bus create a 'Rule' that takes S3 events and forwards it to a Lambda
    Image

Expected Result

JSON Body\payload of the events in sentry console

Actual Result

JSON Body\payload of the events is missing in sentry console

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Jan 31, 2025
@szokeasaurusrex
Copy link
Member

szokeasaurusrex commented Feb 3, 2025

Hi @paulthorburn, could you please provide more details on how to reproduce this issue? In its current state, the issue is not actionable.

Specifically, we need more detail about the following:

Overview:
Step 1 - Create a Lambda Function
Step 2 - Send events from different sources

Please provide the code snippet you are using for the Lambda function. Additionally, please explain what you mean by "Send events from different sources," since it is unclear what kind of "events" you are sending, to where you are sending them, and what the "different sources" are. A step-by-step description of what you are doing would help the most.

@paulthorburn
Copy link
Author

Hey @szokeasaurusrex, thanks for looking into this i raised this issue for 2 reasons

  1. Bug\Issue: In an AWS Lambda and API Gateway or Lambda Function URL integration the payload is not captured as you can see in screenshots Add django integration #2 and Ci #3 the Body in the Sentry UI is just "" even though I sent a POST with a Body.
  2. Product Improvement: AWS Lambda can integrate with 1000's of different AWS Services (not just API Gateway) i think it would be beneficial if you capture the capture the "event" in the lambda and just json pretty print\format it in the sentry ui

For the 2nd reason I had provided 2 examples Test 4 and Test 5 above which high level steps on how to setup the integration

Test 4: S3 Event Notification

Create Lambda, Create S3 Bucket
In S3 bucket under Event notifications point it to the Lambda
Upload File to S3 Bucket

The actual lambda code is irrelevant its the event that is passed to the lambda that I am interested in capturing. Currently only API Gateway events are being captured and that is broken as i mentioned in point 1.

Cheers,
Paul

@getsantry getsantry bot moved this from Waiting for: Community to Waiting for: Product Owner in GitHub Issues with 👀 3 Feb 6, 2025
@sentrivana
Copy link
Contributor

Hey @paulthorburn, thanks for conducting the tests and documenting them. Couple stupid questions just to cover the bases: you do have the send_default_pii setting set to True, correct? And there's actual JSON payload being sent in your examples? (I'm asking since most of them are GET requests.)

It seems there are two problems here, either the body is not included at all, or it's set to "". This is relevant for debugging on our end since that looks like it's hitting two different codepaths in the SDK.

In the empty string case, it looks like we're hitting this line when trying to capture the request body (at least in the "" cases). So it seems that the AWS event contains a body, but it's None for some reason. Hard to say whether this is due to some changes on the AWS Lambda side or if it's a code path that we're not covering for some reason.

I'll put this in our backlog, but can't realistically promise you when we'll get to look at it since our plates are currently pretty full.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

3 participants