Skip to content

Sentry breadcrumbs are not shown in the Express request context  #11516

Closed

Description

@spacetoha

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

7.109.0

Framework Version

7.109.0

Link to Sentry event

https://bringlynl.sentry.io/discover/breadcrumbs-issue:746f68983de34056a2441ce2cfde2375/?field=title&field=event.type&field=project&field=user.display&field=timestamp&name=All+Events&project=4507056912269312&query=&sort=-timestamp&statsPeriod=24h&yAxis=count%28%29

SDK Setup

// You can also use ESM `import * as Sentry from "@sentry/node"` instead of `require`
import * as Sentry from "@sentry/node";
import { nodeProfilingIntegration, } from "@sentry/profiling-node";
import { captureConsoleIntegration } from "@sentry/integrations";
import express from "express";

const app = express();

Sentry.init({
  dsn: "DSN",
  integrations: [
    // enable HTTP calls tracing
   
    new Sentry.Integrations.Http({ tracing: true }),
    new Sentry.Integrations.Express({ app }),
   // captureConsoleIntegration(),
    // enable Express.js middleware tracing
    nodeProfilingIntegration()
  ],
  // Performance Monitoring
  tracesSampleRate: 1.0, //  Capture 100% of the transactions
  // Set sampling rate for profiling - this is relative to tracesSampleRate
  profilesSampleRate: 1.0,
});

// The request handler must be the first middleware on the app
app.use(Sentry.Handlers.requestHandler());

// TracingHandler creates a trace for every incoming request
app.use(Sentry.Handlers.tracingHandler());

// All your controllers should live here
app.get("/test-call", function rootHandler(req, res) {
  const message = 'This message is not shown as console log';
  console.log(message);
  Sentry.addBreadcrumb({
    message: message,
    level: "info",
  });
  res.send("OK")
});

// The error handler must be registered before any other error middleware and after all controllers
app.use(Sentry.Handlers.errorHandler());

// Optional fallthrough error handler
app.use(function onError(err, req, res, next) {
  // The error id is attached to `res.sentry` to be returned
  // and optionally displayed to the user for support.
  res.statusCode = 500;
  res.end(res.sentry + "\n");
});

app.get("/debug-sentry", function mainHandler(req, res) {
  throw new Error("My first Sentry error!");
});

app.listen(3000);

Steps to Reproduce

Sentry is not picking up console logs as breadcrumbs on HTTP requests for express integration.
Adding breadcrumbs explicitly does not work either.

Please find the playground project attached.

We recently stopped seeing breadcrumbs for all the HTTP requests.
We were able to reproduce this issue using a minimum viable project.

Expected Result

Console logs are being shown as breadcrumns in the sentry console on express HTTP event

Actual Result

Console logs are not being shown as breadcrumbs in the sentry console on express HTTP event

Activity

  1. moved this to Waiting for: Product Owner in GitHub Issues with 👀 2on Apr 9, 2024
  2. s1gr1d commented on Apr 11, 2024

    @s1gr1d
    Member

    Hi, thanks for reaching out!

    We recently stopped seeing breadcrumbs for all the HTTP requests.

    Just some follow-up questions on that: Did you change the SDK version before it started to not work anymore? Or was anything else changed in the code?

  3. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 2on Apr 11, 2024
  4. spacetoha commented on Apr 11, 2024

    @spacetoha
    Author

    Hello Sigrid,

    We have upgraded to the latest SDK indeed however rolling it back did not help.

    We use 2 types of transactions in the project.

    • HTTP requests (Breadcrumds stopped working for these)
    • Google functions (Breadcrumbs are working fine. Recorded on the transaction)
  5. moved this to Waiting for: Product Owner in GitHub Issues with 👀 2on Apr 11, 2024
  6. s1gr1d commented on Apr 15, 2024

    @s1gr1d
    Member

    I just tested this with Sentry v7 and v8. This will be fixed in an upcoming v8 release (a beta is coming soon), as we tweaked a lot of scope-related code. This PR adds the tests for making sure this keeps working.

    Would it be possible for you to upgrade the application to the beta which is coming in the next few days? When it still doesn't work, please reach out to us.

  7. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 2on Apr 15, 2024
  8. mydea commented on May 15, 2024

    @mydea
    Member

    v8 stable is out, where this should be fixed - give it a try! I'll close this, feel free to re-open if you still encounter this on v8.0.0!

  9. ghost added on Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions