Skip to content

@sentry/bun throws "TypeError: Cannot replace module namespace object's binding with configurable attribute" #12891

Open
@EvHaus

Description

@EvHaus

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/bun

SDK Version

8.17.0

Framework Version

Bun 1.1.18

Link to Sentry event

https://reserve-sense.sentry.io/issues/5597727361/?project=4506890995499008

SDK Setup/Reproduction Example

import { init } from '@sentry/bun';

init({
	dsn: '__MY_DSN__',
	tracesSampleRate: 0.5,
});

Steps to Reproduce

I'm adding Sentry to my Bun API and I simply added a basic init() call at the start of my server and it immediately crashes with the error below.

I'm using node-file-router and looks like combining it with the init() call causes issues. My code for that is:

import { initFileRouter } from 'node-file-router';
const runFileRouter = await initFileRouter({
	ignoreFilesRegex: [/.\.test/],
});

Expected Result

No failure

Actual Result

App crashes with:

 9 |
10 | // Sets a property on an object, preserving its enumerability.
11 | // This function assumes that the property is already writable.
12 | function defineProperty (obj, name, value) {
13 |   var enumerable = !!obj[name] && obj.propertyIsEnumerable(name)
14 |   Object.defineProperty(obj, name, {
     ^
TypeError: Cannot replace module namespace object's binding with configurable attribute
      at defineProperty (native:1:1)
      at defineProperty (/myproject/node_modules/.pnpm/[email protected]/node_modules/shimmer/index.js:14:10)
      at wrap (/myproject/node_modules/.pnpm/[email protected]/node_modules/shimmer/index.js:74:3)
      at /myproject/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@opentelemetry/instrumentation-http/build/src/http.js:78:13
      at /myproject/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@opentelemetry/instrumentation/build/src/platform/node/RequireInTheMiddleSingleton.js:67:27
      at /myproject/node_modules/.pnpm/[email protected]/node_modules/require-in-the-middle/index.js:281:28
      at /myproject/node_modules/.pnpm/@[email protected]/node_modules/@smithy/node-http-handler/dist-cjs/index.js:150:3
      at anonymous (native:1:1)
      at /myproject/node_modules/.pnpm/[email protected]/node_modules/require-in-the-middle/index.js:295:32
      at /myproject/node_modules/.pnpm/@[email protected]/node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.js:4:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugBunExternal DependencyTo close this issue, an external dependency needs to be adjusted/fixed

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions