getsentry / getsentry/sentry-javascript

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

Open
#12,891 17 comments 12 reactions 0 assignees View on GitHub
Bug Bun External Dependency State: Blocked
Dominant language
TypeScript
Stars
8.7k
Forks
1.8k
Avg merge
1d 17h
Merged PRs (30d)
515

Description

### 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?

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/shimmer@1.2.1/node_modules/shimmer/index.js:14:10)
at wrap (/myproject/node_modules/.pnpm/shimmer@1.2.1/node_modules/shimmer/index.js:74:3)
at /myproject/node_modules/.pnpm/@opentelemetry+instrumentation-http@0.52.1_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/instrumentation-http/build/src/http.js:78:13
at /myproject/node_modules/.pnpm/@opentelemetry+instrumentation@0.52.1_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/instrumentation/build/src/platform/node/RequireInTheMiddleSingleton.js:67:27
at /myproject/node_modules/.pnpm/require-in-the-middle@7.3.0/node_modules/require-in-the-middle/index.js:281:28
at /myproject/node_modules/.pnpm/@smithy+node-http-handler@3.1.2/node_modules/@smithy/node-http-handler/dist-cjs/index.js:150:3
at anonymous (native:1:1)
at /myproject/node_modules/.pnpm/require-in-the-middle@7.3.0/node_modules/require-in-the-middle/index.js:295:32
at /myproject/node_modules/.pnpm/@smithy+util-stream@3.0.6/node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.js:4:1
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.