Skip to content

Commit 167abda

Browse files
authored
Amend secondary default endpoints (#2584)
* refactor: 🚚 Change insighthub to bugsnag for secondary endpoints
1 parent 1497079 commit 167abda

3 files changed

Lines changed: 18 additions & 17 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
### Changed
1010

1111
- Update bugsnag-cocoa to [v6.34.0](https//github.com/bugsnag/bugsnag-cocoa/releases/tag/v6.34.0) [#2571](https://github.com/bugsnag/bugsnag-js/pull/2571)
12+
- Amend secondary default notify and sessions endpoints to `bugsnag.smartbear.com` [#2584](https://github.com/bugsnag/bugsnag-js/pull/2584)
1213

1314
## [8.6.0] - 2025-09-25
1415

packages/core/client.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ const metadataDelegate = require('./lib/metadata-delegate')
1313
const runSyncCallbacks = require('./lib/sync-callback-runner')
1414
const BREADCRUMB_TYPES = require('./lib/breadcrumb-types')
1515
const { add, clear, merge } = require('./lib/feature-flag-delegate')
16-
const HUB_PREFIX = '00000'
17-
const HUB_NOTIFY = 'https://notify.insighthub.smartbear.com'
18-
const HUB_SESSION = 'https://sessions.insighthub.smartbear.com'
16+
const SECONDARY_ENDPOINT_API_KEY_PREFIX = '00000'
17+
const SECONDARY_NOTIFY_ENDPOINT = 'https://notify.bugsnag.smartbear.com'
18+
const SECONDARY_SESSIONS_ENDPOINT = 'https://sessions.bugsnag.smartbear.com'
1919

2020
const noop = () => { }
2121

@@ -169,10 +169,10 @@ class Client {
169169
// warn about an apikey that is not of the expected format
170170
if (!/^[0-9a-f]{32}$/i.test(config.apiKey)) errors.apiKey = 'should be a string of 32 hexadecimal characters'
171171

172-
if (opts.endpoints === undefined && config.apiKey.indexOf(HUB_PREFIX) === 0) {
172+
if (opts.endpoints === undefined && config.apiKey.indexOf(SECONDARY_ENDPOINT_API_KEY_PREFIX) === 0) {
173173
config.endpoints = {
174-
notify: HUB_NOTIFY,
175-
sessions: HUB_SESSION
174+
notify: SECONDARY_NOTIFY_ENDPOINT,
175+
sessions: SECONDARY_SESSIONS_ENDPOINT
176176
}
177177
}
178178
}

packages/core/test/endpoints.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@ const Client = require('../client')
55
/* --------------------------------------------------------------------------
66
* Constants – keep tests self-contained
77
* ------------------------------------------------------------------------ */
8-
const HUB_PREFIX = '00000'
9-
const HUB_NOTIFY = 'https://notify.insighthub.smartbear.com'
10-
const HUB_SESSION = 'https://sessions.insighthub.smartbear.com'
8+
const SECONDARY_ENDPOINT_API_KEY_PREFIX = '00000'
9+
const SECONDARY_NOTIFY = 'https://notify.bugsnag.smartbear.com'
10+
const SECONDARY_SESSION = 'https://sessions.bugsnag.smartbear.com'
1111
const BUGSNAG_NOTIFY = 'https://notify.bugsnag.com'
1212
const BUGSNAG_SESSION = 'https://sessions.bugsnag.com'
13-
const HUB_KEY = `${HUB_PREFIX}abcdef0123456789abcdef012345`
13+
const PREFIXED_KEY = `${SECONDARY_ENDPOINT_API_KEY_PREFIX}abcdef0123456789abcdef012345`
1414
const NORMAL_KEY = 'abcdef0123456789abcdef0123456789'
1515

1616
describe('endpoint selection', () => {
17-
describe('Client → automatic InsightHub switch', () => {
18-
it('swaps to InsightHub urls when apiKey starts with 00000', () => {
19-
const client = new Client({ apiKey: HUB_KEY })
17+
describe('Client → automatic BugSnag switch', () => {
18+
it('swaps to secondary urls when apiKey starts with 00000', () => {
19+
const client = new Client({ apiKey: PREFIXED_KEY })
2020
expect(client._config.endpoints).toEqual({
21-
notify: HUB_NOTIFY,
22-
sessions: HUB_SESSION
21+
notify: SECONDARY_NOTIFY,
22+
sessions: SECONDARY_SESSION
2323
})
2424
})
2525

26-
it('keeps Bugsnag urls otherwise', () => {
26+
it('keeps default urls otherwise', () => {
2727
const client = new Client({ apiKey: NORMAL_KEY })
2828
expect(client._config.endpoints).toEqual({
2929
notify: BUGSNAG_NOTIFY,
@@ -33,7 +33,7 @@ describe('endpoint selection', () => {
3333

3434
it('does **not** switch if custom endpoints are supplied', () => {
3535
const custom = { notify: 'https://n.example.com', sessions: 'https://s.example.com' }
36-
const client = new Client({ apiKey: HUB_KEY, endpoints: custom })
36+
const client = new Client({ apiKey: PREFIXED_KEY, endpoints: custom })
3737
expect(client._config.endpoints).toBe(custom)
3838
})
3939
})

0 commit comments

Comments
 (0)