self-hosted icon indicating copy to clipboard operation
self-hosted copied to clipboard

No issues after updating from 24.6.0 to 24.7.0

Open yaneony opened this issue 1 year ago • 7 comments

Is there an existing issue for this?

  • [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
  • [x] I have reviewed the documentation https://docs.sentry.io/
  • [x] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases

How do you use Sentry?

Self-hosted/on-premise

Which SDK are you using?

@sentry/node

SDK Version

8.19.0

Framework Version

Fastify 4.28.1

Link to Sentry event

No response

SDK Setup/Reproduction Example

index.js

require("./instrument.js");

const Sentry = require("@sentry/node");
const Fastify = require('fastify')

const app = Fastify();

Sentry.setupFastifyErrorHandler(app);

app.get("/", function rootHandler(req, res) {
  res.send("Hello world!");
});

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

app.listen({ port: 3000 });

instrument.js

const Sentry = require("@sentry/node");

Sentry.init({
  debug: true,
  dsn: "https://[email protected]/12",
  tracesSampleRate: 1.0
});

Steps to Reproduce

Follow official docs.

Expected Result

At least to see some issue on Sentry.

Actual Result

Fastify is starting well, but not a single issue appear on sentry. Enabled debug, that's what I see:

After app is running:

Sentry Logger [log]: Initializing Sentry: process: 8188, thread: main.
Sentry Logger [log]: Integration installed: InboundFilters
Sentry Logger [log]: Integration installed: FunctionToString
Sentry Logger [log]: Integration installed: LinkedErrors
Sentry Logger [log]: Integration installed: RequestData
Sentry Logger [log]: Integration installed: Console
Sentry Logger [log]: Integration installed: Http
Sentry Logger [log]: Integration installed: NodeFetch
Sentry Logger [log]: Integration installed: OnUncaughtException
Sentry Logger [log]: Integration installed: OnUnhandledRejection
Sentry Logger [log]: Integration installed: ContextLines
Sentry Logger [log]: Integration installed: LocalVariablesAsync
Sentry Logger [log]: Integration installed: Context
Sentry Logger [log]: Integration installed: Modules
Sentry Logger [log]: Integration installed: Express
Sentry Logger [log]: Integration installed: Fastify
Sentry Logger [log]: Integration installed: Graphql
Sentry Logger [log]: Integration installed: Mongo
Sentry Logger [log]: Integration installed: Mongoose
Sentry Logger [log]: Integration installed: Mysql
Sentry Logger [log]: Integration installed: Mysql2
Sentry Logger [log]: Integration installed: Redis
Sentry Logger [log]: Integration installed: Postgres
Sentry Logger [log]: Integration installed: Nest
Sentry Logger [log]: Integration installed: Hapi
Sentry Logger [log]: Integration installed: Koa
Sentry Logger [log]: Integration installed: Connect
Sentry Logger [log]: Running in CommonJS mode.
Sentry Logger [debug]: @opentelemetry/api: Registered a global for diag v1.9.0.
Sentry Logger [debug]: @opentelemetry/api: Registered a global for trace v1.9.0.
Sentry Logger [debug]: @opentelemetry/api: Registered a global for context v1.9.0.
Sentry Logger [debug]: @opentelemetry/api: Registered a global for propagation v1.9.0.
Sentry Logger [debug]: @opentelemetry/instrumentation-http Applying instrumentation patch for nodejs core module on require hook { module: 'http' }
Sentry Logger [debug]: @opentelemetry/instrumentation-http Applying instrumentation patch for nodejs core module on require hook { module: 'https' }
Sentry Logger [debug]: @opentelemetry/instrumentation-fastify Applying instrumentation patch for module on require hook {
  module: 'fastify',
  version: '4.28.1',
  baseDir: 'c:\\Repos\\_tests\\sentry\\node_modules\\fastify'
}
Sentry Logger [debug]: @opentelemetry/instrumentation-fastify Patching fastify preHandler function
Sentry Logger [debug]: @opentelemetry/instrumentation-fastify Patching fastify server.addHook function
Sentry Logger [debug]: @opentelemetry/instrumentation-fastify Patching fastify route.handler function
Sentry Logger [debug]: @opentelemetry/instrumentation-fastify Patching fastify route.handler function

When calling http://127.0.0.1:3000/debug-sentry

Sentry Logger [debug]: @opentelemetry/instrumentation-http http instrumentation incomingRequest
Sentry Logger [log]: [Tracing] Starting sampled root span
  op: < unknown op >
  name: GET
  ID: df4461f20c95dd4b
Sentry Logger [debug]: @opentelemetry/instrumentation-fastify Patching fastify reply.send function
Sentry Logger [log]: [Tracing] Inheriting parent's sampled decision for middleware - fastify -> sentry-fastify-error-handler: true
Sentry Logger [log]: [Tracing] Starting sampled span
  op: < unknown op >
  name: middleware - fastify -> sentry-fastify-error-handler
  ID: ae3eeefe65406843
  parent ID: df4461f20c95dd4b
  root ID: df4461f20c95dd4b
  root description: GET
Sentry Logger [log]: [Tracing] Finishing "middleware.fastify" span "sentry-fastify-error-handler" with ID ae3eeefe65406843
Sentry Logger [log]: SpanExporter has 1 unsent spans remaining
Sentry Logger [log]: [Tracing] Inheriting parent's sampled decision for request handler - mainHandler: true
Sentry Logger [log]: [Tracing] Starting sampled span
  op: < unknown op >
  name: request handler - mainHandler
  ID: 3fa1986463891469
  parent ID: df4461f20c95dd4b
  root ID: df4461f20c95dd4b
  root description: GET
Sentry Logger [log]: [Tracing] Inheriting parent's sampled decision for middleware - fastify -> sentry-fastify-error-handler: true
Sentry Logger [log]: [Tracing] Starting sampled span
  op: < unknown op >
  name: middleware - fastify -> sentry-fastify-error-handler
  ID: 6d16c12e59234b5b
  parent ID: 3fa1986463891469
  root ID: df4461f20c95dd4b
  root description: GET
Sentry Logger [log]: [Tracing] Finishing "request_handler.fastify" span "mainHandler" with ID 3fa1986463891469
Sentry Logger [log]: SpanExporter has 2 unsent spans remaining
Sentry Logger [log]: [Tracing] Finishing "middleware.fastify" span "sentry-fastify-error-handler" with ID 6d16c12e59234b5b
Sentry Logger [log]: SpanExporter has 3 unsent spans remaining
Sentry Logger [log]: [Tracing] Finishing "< unknown op >" root span "GET /debug-sentry" with ID df4461f20c95dd4b
Sentry Logger [log]: SpanExporter exported 4 spans, 0 unsent spans remaining
Sentry Logger [debug]: @opentelemetry/instrumentation-http http instrumentation incomingRequest
Sentry Logger [log]: [Tracing] Starting sampled root span
  op: < unknown op >
  name: GET
  ID: 32a011984aaf59bf
Sentry Logger [debug]: @opentelemetry/instrumentation-fastify Patching fastify reply.send function
Sentry Logger [log]: [Tracing] Inheriting parent's sampled decision for middleware - fastify -> sentry-fastify-error-handler: true
Sentry Logger [log]: [Tracing] Starting sampled span
  op: < unknown op >
  name: middleware - fastify -> sentry-fastify-error-handler
  ID: 4f5e93245ca1fda7
  parent ID: 32a011984aaf59bf
  root ID: 32a011984aaf59bf
  root description: GET
Sentry Logger [log]: [Tracing] Finishing "middleware.fastify" span "sentry-fastify-error-handler" with ID 4f5e93245ca1fda7
Sentry Logger [log]: SpanExporter has 1 unsent spans remaining
(node:8188) [FSTDEP017] DeprecationWarning: You are accessing the deprecated "request.routerPath" property. Use "request.routeOptions.url" instead. Property "req.routerPath" will be removed in `fastify@5`.
(Use `node --trace-deprecation ...` to show where the warning was created)
Sentry Logger [log]: [Tracing] Inheriting parent's sampled decision for request handler - basic404: true
Sentry Logger [log]: [Tracing] Starting sampled span
  op: < unknown op >
  name: request handler - basic404
  ID: 1759163b0bb65c95
  parent ID: 32a011984aaf59bf
  root ID: 32a011984aaf59bf
  root description: GET
Sentry Logger [log]: [Tracing] Finishing "request_handler.fastify" span "basic404" with ID 1759163b0bb65c95
Sentry Logger [log]: SpanExporter has 2 unsent spans remaining
Sentry Logger [log]: [Tracing] Finishing "< unknown op >" root span "GET" with ID 32a011984aaf59bf
Sentry Logger [log]: SpanExporter exported 3 spans, 0 unsent spans remaining

Waiting and checking issues on self-hosted Sentry 24.7.0 display not a single issue or anything else.

yaneony avatar Jul 22 '24 09:07 yaneony

hello,

Could you add this to your config to test this further:

Sentry.init({
  // ... other config
  beforeSend(event) {
    console.log("ERROR TO BE SENT", event);
    return event;
  }
});

We do have a test for this here: https://github.com/getsentry/sentry-javascript/blob/develop/dev-packages/e2e-tests/test-applications/node-fastify/src/app.ts#L84, so I would be surprised if that wasn't working 🤔

mydea avatar Jul 22 '24 13:07 mydea

Found the problem. Reverted back to "Sentry 24.6.0" and everything is working like expected!

yaneony avatar Jul 22 '24 15:07 yaneony

Interesting - what version of self hosted where you before? The latest one?

mydea avatar Jul 23 '24 08:07 mydea

Yes, Sentry 24.7.0. Upgraded from Sentry 24.6.0. Tested all scenarios, restarted VM/Docker multiple times, restarted containers, waited about 1 hour... 5 Projects reported not a single issue. Restored backup of Sentry 24.6.0 and everything went well.

yaneony avatar Jul 23 '24 08:07 yaneony

Very weird! I will move this to the self-hosted repository, because I guess this may be a problem there then!

mydea avatar Jul 23 '24 08:07 mydea

Can you ensure that events are being sent to your instance through your nginx logs? I'm wondering if this is a regression that shipped within our web container. Also, are there any details in your web container logs that might be useful here?

hubertdeng123 avatar Jul 24 '24 22:07 hubertdeng123

I'm in Production and can't upgrade just for test. Sorry...

yaneony avatar Aug 13 '24 18:08 yaneony

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

getsantry[bot] avatar Sep 06 '24 07:09 getsantry[bot]