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

Sentry Express + Serverless losing transaction #5

Open
3 tasks done
hiroshinishio opened this issue Oct 5, 2024 · 2 comments
Open
3 tasks done

Sentry Express + Serverless losing transaction #5

hiroshinishio opened this issue Oct 5, 2024 · 2 comments

Comments

@hiroshinishio
Copy link
Owner

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

8.33.1

Framework Version

express 4.18.2, serverless-http 3.1.1

Link to Sentry event

https://amplify-30.sentry.io/issues/5951306644/?environment=development&project=4506665822584832&query=is%3Aunresolved%20issue.priority%3A%5Bhigh%2C%20medium%5D&referrer=issue-stream&statsPeriod=1h&stream_index=0

Reproduction Example/SDK Setup

import {init, setupExpressErrorHandler} from '@sentry/node';
import {nodeProfilingIntegration} from '@sentry/profiling-node';

init({
  dsn: process.env.SENTRY_DSN,
  environment: 'development',

  integrations: [nodeProfilingIntegration()],

  tracesSampleRate: 1.0,
  profilesSampleRate: 1.0,
});

import express from 'express';
import serverless from 'serverless-http';

const app = express();

app.get('/debug-sentry/:test', (req, res) => {
  throw new Error('My first Sentry error!');
});

setupExpressErrorHandler(app);

export const handler = serverless(app);

Steps to Reproduce

Run the above file as a single file using serverless and serverless-offline plugin.

Then run curl http://localhost:3000/debug-sentry/hello

I've removed the serverless part and just started it as a raw express server using node index.js, which successfully logs the error, so it must be specific to the serverless-http wrapper.

I've also tried using @sentry/aws-serverless instead of @sentry/node which sadly logs nothing, presumably since express already handles the error.

Sentry 7 is logging errors correctly with the serverless + express combo.

Expected Result

Issue with URL, Headers & Query params

Image

Actual Result

Also missing headers + query params

Image

Copy link

gitauto-ai bot commented Oct 5, 2024

Click the checkbox below to generate a PR!

  • Generate PR

@hiroshinishio, You have 5 requests left in this cycle which refreshes on 2024-11-04 02:56:25+00:00.
If you have any questions or concerns, please contact us at [email protected].

Copy link

gitauto-ai bot commented Oct 5, 2024

Sorry, we have an error. Please try again.

Have feedback or need help?
Feel free to email [email protected].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant