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

Not useable with bun > freeze loading #9547

Closed
approached opened this issue Nov 13, 2023 · 9 comments
Closed

Not useable with bun > freeze loading #9547

approached opened this issue Nov 13, 2023 · 9 comments
Labels
Package: bun Issues related to the Sentry Bun SDK

Comments

@approached
Copy link

Environment

SaaS (https://sentry.io/)

Steps to Reproduce

import * as Sentry from "@sentry/bun";
import { Elysia, t } from "elysia";
import { auth } from "./lib/firebase_pro";

Sentry.init({
	dsn: process.env.SENTRY_DSN,
	environment: process.env.NODE_ENV,
	release: "1",
	tracesSampleRate: 0.0,
	tracesSampler: () => false,
	sampleRate: 0.0,
	debug: true,
	enableTracing: false,
	autoSessionTracking: false,
	sendClientReports: false,
	// enabled: false,
});

const app = new Elysia({})
	.get("/doc", async () => {
		return await auth.listUsers(2);
	})
	.get("/", () => new Date().toISOString())
	.listen(3001);

console.log(
	`🦊 Elysia is running at http://${app.server?.hostname}:${app.server?.port}/doc`,
);

Expected Result

Userlist from firebase admin sdk.

Actual Result

Loading freeze, no output. Only if disable sentry.

Logs:

Sentry Logger [log]: Integration installed: InboundFilters
Sentry Logger [log]: Integration installed: FunctionToString
Sentry Logger [log]: Integration installed: LinkedErrors
Sentry Logger [log]: Integration installed: Console
Sentry Logger [log]: Integration installed: Http
Sentry Logger [log]: Integration installed: Undici
Sentry Logger [log]: Integration installed: ContextLines
Sentry Logger [log]: Integration installed: Context
Sentry Logger [log]: Integration installed: Modules
Sentry Logger [log]: Integration installed: RequestData
Sentry Logger [log]: Integration installed: BunServer
🦊 Elysia is running at http://localhost:3001/doc
Sentry Logger [log]: [Tracing] Discarding transaction because a negative sampling decision was inherited or tracesSampleRate is set to 0
Sentry Logger [log]: [Tracing] Starting 'http.client' span on transaction 'GET /doc' (ba55c567a3267677).
Sentry Logger [log]: [Tracing] Adding sentry-trace header aa3e5be184744a52b1a42bccc58efff7-ab29aac83a9ffd5d-0 to outgoing request to "https://accounts.google.com:443/o/oauth2/token":
Sentry Logger [log]: [Tracing] Starting 'http.client' span on transaction 'GET /doc' (ba55c567a3267677).
Sentry Logger [log]: [Tracing] Finishing 'http.client' span on transaction 'GET /doc' (ba55c567a3267677).
Sentry Logger [log]: [Tracing] Finishing 'http.client' span on transaction 'GET /doc' (ba55c567a3267677).

How i can disable sentry-trace?

Product Area

Unknown

Link

No response

DSN

No response

Version

No response

@getsantry
Copy link

getsantry bot commented Nov 13, 2023

Assigning to @getsentry/support for routing ⏲️

@approached approached changed the title Not useable with bun Not useable with bun > freeze loading Nov 13, 2023
@kerenkhatiwada kerenkhatiwada transferred this issue from getsentry/sentry Nov 13, 2023
@getsantry getsantry bot moved this from Waiting for: Support to Waiting for: Product Owner in GitHub Issues with 👀 Nov 13, 2023
@lforst lforst added the Package: bun Issues related to the Sentry Bun SDK label Nov 15, 2023
@lforst
Copy link
Member

lforst commented Nov 15, 2023

Thanks for reporting! We will take a look.

@AbhiPrasad
Copy link
Member

@approached could you run this in Node (might need to install the elysia adapter) and patch the global Bun object like so:

globalThis.Bun = {
  version: '',
  serve: () => undefined,
};

This will tell us if the issue is because of something @sentry/bun is doing or if it's a problem with the bun runtime itself. Thanks!

@approached
Copy link
Author

approached commented Nov 27, 2023

@AbhiPrasad

➜  api git:(master) ✗ bun run src/index.ts
1 | globalThis.Bun = {
  version: "",
  serve: () => {
    return;
  }
};
   ^
TypeError: Attempted to assign to readonly property.
      at .../backend/api/src/index.ts:1:0

Version: Bun v1.0.14

@AbhiPrasad
Copy link
Member

Version: Bun v1.0.14

I meant run this in via npx ts-node src/index.ts (or similar to run ts) to test if the issue is with Sentry or with Bun.

As per #9516 (comment), this is a issue with Bun. I would recommend you open an issue with https://github.com/oven-sh/bun

@approached
Copy link
Author

@AbhiPrasad this already exists: oven-sh/bun#5091

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Nov 28, 2023
@AbhiPrasad
Copy link
Member

Hey @approached that linked GH issue is about support for global error handlers with Bun, not about the problem that has been reported here. That will require a different GH issue.

@approached
Copy link
Author

I have the same issue like: #9564

Sentry.init({
	dsn: process.env.SENTRY_DSN,
	environment: process.env.NODE_ENV,
	release:version,
	enabled: true,
	enableTracing: false,
	integrations: (int) => int.filter((i) => !["BunServer", "Http"].includes(i.name)),
});

This filter worked for me.

@AbhiPrasad
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: bun Issues related to the Sentry Bun SDK
Projects
Archived in project
Development

No branches or pull requests

3 participants