Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
97e6ff3
[v7] feat: Remove references to @sentry/apm (#4845)
AbhiPrasad Apr 7, 2022
57d37c2
[v7] feat(core): Delete API class (#4848)
AbhiPrasad Apr 7, 2022
424df27
[v7] feat: Delete deprecated `startSpan` and `child` methods (#4849)
AbhiPrasad Apr 7, 2022
5a7f145
feat(core): Remove whitelistUrls/blacklistUrls (#4850)
AbhiPrasad Apr 7, 2022
f855260
feat(gatsby): Remove Sentry from window (#4857)
AbhiPrasad Apr 7, 2022
f1e9da2
feat(hub): Remove getActiveDomain (#4858)
AbhiPrasad Apr 7, 2022
55b0570
feat(types): Remove deprecated user dsn field (#4864)
AbhiPrasad Apr 7, 2022
2fc13c6
feat(hub): Remove setTransaction scope method (#4865)
AbhiPrasad Apr 7, 2022
20c7773
[v7] feat: Drop support for Node 6 (#4851)
AbhiPrasad Apr 7, 2022
244eb0e
[v7] feat(tracing): Rename registerRequestInstrumentation -> instrume…
AbhiPrasad Apr 7, 2022
285ca26
fix(test): Increase MongoMemoryServer creation timeout (#4881)
Lms24 Apr 7, 2022
fb1b74f
[v7] feat(node): Remove deprecated `frameContextLines` (#4884)
timfish Apr 7, 2022
81b10fb
[v7] feat(browser): Remove top level eventbuilder exports (#4887)
timfish Apr 7, 2022
a0792da
Merge branch '7.x' of https://github.com/getsentry/sentry-javascript …
timfish Apr 8, 2022
79084f2
Mostly working
timfish Apr 8, 2022
52047b6
Lint
timfish Apr 8, 2022
14a10dc
make generic across all javascript
timfish Apr 8, 2022
dc765c7
Merge remote-tracking branch 'upstream/7.x' into v7/configurable-stac…
timfish Apr 8, 2022
0988600
Fix build
timfish Apr 8, 2022
c6e8a60
export nodeStackParser
timfish Apr 8, 2022
03b5d5c
Fix test
timfish Apr 8, 2022
7943990
Merge 'upstream/7.x' into v7/configurable-stack-parser
timfish Apr 12, 2022
623fcfd
Fix tests from bad merge
timfish Apr 12, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(gatsby): Remove Sentry from window (#4857)
  • Loading branch information
AbhiPrasad authored and Lms24 committed Apr 7, 2022
commit f855260c904f939b712b9fb7044a3528a51d73b4
8 changes: 3 additions & 5 deletions packages/gatsby/gatsby-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ exports.onClientEntry = function (_, pluginParams) {
const areOptionsDefined = areSentryOptionsDefined(pluginParams);

if (isIntialized) {
window.Sentry = Sentry; // For backwards compatibility
if (areOptionsDefined) {
console.warn(
'Sentry Logger [Warn]: The SDK was initialized in the Sentry config file, but options were found in the Gatsby config. ' +
'These have been ignored, merge them to the Sentry config if you want to use them.\n' +
'Learn more about the Gatsby SDK on https://docs.sentry.io/platforms/javascript/guides/gatsby/',
'These have been ignored, merge them to the Sentry config if you want to use them.\n' +
'Learn more about the Gatsby SDK on https://docs.sentry.io/platforms/javascript/guides/gatsby/',
);
}
return;
Expand All @@ -20,7 +19,7 @@ exports.onClientEntry = function (_, pluginParams) {
if (!areOptionsDefined) {
console.error(
'Sentry Logger [Error]: No config for the Gatsby SDK was found.\n' +
'Learn how to configure it on https://docs.sentry.io/platforms/javascript/guides/gatsby/',
'Learn how to configure it on https://docs.sentry.io/platforms/javascript/guides/gatsby/',
);
return;
}
Expand All @@ -32,7 +31,6 @@ exports.onClientEntry = function (_, pluginParams) {
dsn: __SENTRY_DSN__,
...pluginParams,
});
window.Sentry = Sentry; // For backwards compatibility
};

function isSentryInitialized() {
Expand Down
10 changes: 0 additions & 10 deletions packages/gatsby/test/gatsby-browser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ describe('onClientEntry', () => {
tracingAddExtensionMethods = jest.fn();
});

afterEach(() => {
(window as any).Sentry = undefined;
});

it.each([
[{}, ['dsn', 'release']],
[{ key: 'value' }, ['dsn', 'release', 'key']],
Expand All @@ -54,7 +50,6 @@ describe('onClientEntry', () => {

describe('inits Sentry once', () => {
afterEach(() => {
delete (window as any).Sentry;
delete (window as any).__SENTRY__;
(global.console.warn as jest.Mock).mockClear();
(global.console.error as jest.Mock).mockClear();
Expand All @@ -78,7 +73,6 @@ describe('onClientEntry', () => {
// eslint-disable-next-line no-console
expect(console.error).not.toHaveBeenCalled();
expect(sentryInit).not.toHaveBeenCalled();
expect((window as any).Sentry).toBeDefined();
});

it('initialized in injected config, with pluginParams', () => {
Expand All @@ -94,7 +88,6 @@ describe('onClientEntry', () => {
// eslint-disable-next-line no-console
expect(console.error).not.toHaveBeenCalled();
expect(sentryInit).not.toHaveBeenCalled();
expect((window as any).Sentry).toBeDefined();
});

it('not initialized in injected config, without pluginParams', () => {
Expand All @@ -108,7 +101,6 @@ describe('onClientEntry', () => {
Learn how to configure it on https://docs.sentry.io/platforms/javascript/guides/gatsby/",
]
`);
expect((window as any).Sentry).not.toBeDefined();
});

it('not initialized in injected config, with pluginParams', () => {
Expand All @@ -125,7 +117,6 @@ describe('onClientEntry', () => {
"release": "release",
}
`);
expect((window as any).Sentry).toBeDefined();
});
});

Expand Down Expand Up @@ -164,7 +155,6 @@ describe('onClientEntry', () => {
it('does not run if plugin params are undefined', () => {
onClientEntry();
expect(sentryInit).toHaveBeenCalledTimes(0);
expect((window as any).Sentry).toBeUndefined();
expect(tracingAddExtensionMethods).toHaveBeenCalledTimes(0);
});
});
3 changes: 2 additions & 1 deletion packages/gatsby/test/integration.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useEffect } from 'react';
import * as React from 'react';

import { onClientEntry } from '../gatsby-browser';
import * as Sentry from '../src';

beforeAll(() => {
(global as any).__SENTRY_RELEASE__ = '683f3a6ab819d47d23abfca9a914c81f0524d35b';
Expand All @@ -28,7 +29,7 @@ describe('useEffect', () => {
function TestComponent() {
useEffect(() => {
const error = new Error('testing 123');
(window as any).Sentry.captureException(error);
Sentry.captureException(error);
});

return <div>Hello</div>;
Expand Down