forked from getsentry/sentry-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure instrumentation of Bun.serve survives a server reload
If `#reload` is called on an instance of `Bun.serve`, the Sentry intrumentation doesn't surive. This is because the Bun instrumentation works by using `Proxy` on the call to `Bun.serve`, which isn't called for a reload. We can't wrap the serve created by calling `Bun.serve` with a `Proxy` as Bun seems to do some internal checks using `instanceof` which break if the instance is now reporting itself as a `ProxyObject`. This fixes getsentry#15144.
- Loading branch information
1 parent
b49c1cc
commit 16b41ad
Showing
3 changed files
with
119 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
import { expect, test } from 'bun:test'; | ||
import { describe, expect, test } from 'bun:test'; | ||
|
||
import { init } from '../src/index'; | ||
|
||
test("calling init shouldn't fail", () => { | ||
init({ | ||
describe('Bun SDK', () => { | ||
const initOptions = { | ||
dsn: 'https://[email protected]/0000000', | ||
tracesSampleRate: 1, | ||
}; | ||
|
||
test("calling init shouldn't fail", () => { | ||
expect(() => { | ||
init(initOptions); | ||
}).not.toThrow(); | ||
}); | ||
expect(true).toBe(true); | ||
}); | ||
|
||
test('should return client from init', () => { | ||
expect(init({})).not.toBeUndefined(); | ||
test('should return client from init', () => { | ||
expect(init(initOptions)).not.toBeUndefined(); | ||
}); | ||
}); |