Skip to content

Commit a037573

Browse files
Merge pull request #7017 from getsentry/develop
[Gitflow] Merge develop into master
2 parents a6c6b2a + b9a004f commit a037573

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1013
-909
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ jobs:
379379
- name: Pack
380380
run: yarn build:tarball
381381
- name: Archive artifacts
382-
uses: actions/[email protected].1
382+
uses: actions/[email protected].2
383383
with:
384384
name: ${{ github.sha }}
385385
path: |
@@ -833,7 +833,7 @@ jobs:
833833
GITHUB_TOKEN: ${{ github.token }}
834834

835835
- name: Upload results
836-
uses: actions/upload-artifact@v3
836+
uses: actions/upload-artifact@v3.1.2
837837
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
838838
with:
839839
name: ${{ steps.process.outputs.artifactName }}

.github/workflows/gitflow-sync-develop.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
destination_branch: ${{ env.DEV_BRANCH }}
3333
pr_title: '[Gitflow] Merge ${{ github.ref_name }} into ${{ env.DEV_BRANCH }}'
3434
pr_body: 'Merge ${{ github.ref_name }} branch into ${{ env.DEV_BRANCH }}'
35+
pr_label: 'Dev: Gitflow'
3536

3637
# https://github.com/marketplace/actions/enable-pull-request-automerge
3738
- name: Enable automerge for PR

.github/workflows/gitflow-sync-master.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
destination_branch: ${{ env.MAIN_BRANCH }}
3535
pr_title: '[Gitflow] Merge ${{ github.ref_name }} into ${{ env.MAIN_BRANCH }}'
3636
pr_body: 'Merge ${{ github.ref_name }} branch into ${{ env.MAIN_BRANCH }}'
37+
pr_label: 'Dev: Gitflow'
3738

3839
# https://github.com/marketplace/actions/enable-pull-request-automerge
3940
- name: Enable automerge for PR

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,29 @@
44

55
- "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott
66

7+
## 7.35.0
8+
9+
Session Replay is deprecating privacy options in favor of a more streamlined API. Please see the [Replay migration guide](https://github.com/getsentry/sentry-javascript/blob/master/packages/replay/MIGRATION.md) for further information.
10+
Additionally, the following configuration options will no longer be configurable: `slimDOMOptions`, `recordCanvas`, `inlineStylesheet`, `collectFonts`, `inlineImages`.
11+
12+
- feat(browser): Track if cdn or npm bundle (#6976)
13+
- feat(core): Add aria label to breadcrumb attributes (#6955)
14+
- feat(core): Add Offline Transport wrapper (#6884)
15+
- feat(loader): Add SENTRY_SDK_SOURCE to track loader stats (#6985)
16+
- feat(loader): Sync loader with Sentry template (#7001)
17+
- feat(replay): Deprecate privacy options in favor of a new API, remove some recording options (#6645)
18+
- feat(replay): Move sample rate tags into event context (#6659)
19+
- fix(nextjs): Add isomorphic versions of `ErrorBoundary`, `withErrorBoundary` and `showReportDialog` (#6987)
20+
- fix(nextjs): Don't modify require calls in wrapping loader (#6979)
21+
- fix(nextjs): Don't share I/O resources in between requests (#6980)
22+
- fix(nextjs): Inject client config into `_app` instead of `main` (#7009)
23+
- fix(nextjs): Use Proxies to wrap to preserve static methods (#7002)
24+
- fix(replay): Catch style mutation handling & null events in rrweb (#7010)
25+
- fix(replay): Handle compression failures more robustly (#6988)
26+
- fix(replay): Only call `scope.getLastBreadcrumb` if available (#6969)
27+
- fix(utils): Account for null prototype during normalization (#6925)
28+
- ref(replay): Log warning if sample rates are all undefined (#6959)
29+
730
## 7.34.0
831

932
This release adds automatic injection of the Next.js SDK into serverside `app` directory bundles, allowing users to call the Sentry SDK in server components.

MIGRATION.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Deprecations in 7.x
22

3+
## Replay options changed (since 7.35.0) - #6645
4+
5+
Some options for replay have been depracted in favor of new APIs.
6+
See [Replay Migration docs](./packages/replay/MIGRATION.md#upgrading-replay-from-7340-to-7350) for details.
7+
38
## Renaming of Next.js wrapper methods (since 7.31.0) - #6790
49

510
We updated the names of the functions to wrap data fetchers and API routes to better reflect what they are doing.

packages/browser/src/loader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
var _currentScriptTag = _document.scripts[0];
6262
var _newScriptTag = _document.createElement(_script);
6363
_newScriptTag.src = _sdkBundleUrl;
64-
_newScriptTag.setAttribute('crossorigin', 'anonymous');
64+
_newScriptTag.crossOrigin = 'anonymous';
6565

6666
// Once our SDK is loaded
6767
_newScriptTag.addEventListener('load', function() {

packages/nextjs/src/client/wrapAppGetInitialPropsWithSentry.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ type AppGetInitialProps = typeof App['getInitialProps'];
77
* so we are consistent with the serverside implementation.
88
*/
99
export function wrapAppGetInitialPropsWithSentry(origAppGetInitialProps: AppGetInitialProps): AppGetInitialProps {
10-
return async function (this: unknown, ...args: Parameters<AppGetInitialProps>): ReturnType<AppGetInitialProps> {
11-
return await origAppGetInitialProps.apply(this, args);
12-
};
10+
return new Proxy(origAppGetInitialProps, {
11+
apply: async (wrappingTarget, thisArg, args: Parameters<AppGetInitialProps>) => {
12+
return await wrappingTarget.apply(thisArg, args);
13+
},
14+
});
1315
}
1416

1517
/**

packages/nextjs/src/client/wrapDocumentGetInitialPropsWithSentry.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ type DocumentGetInitialProps = typeof Document.getInitialProps;
99
export function wrapDocumentGetInitialPropsWithSentry(
1010
origDocumentGetInitialProps: DocumentGetInitialProps,
1111
): DocumentGetInitialProps {
12-
return async function (
13-
this: unknown,
14-
...args: Parameters<DocumentGetInitialProps>
15-
): ReturnType<DocumentGetInitialProps> {
16-
return await origDocumentGetInitialProps.apply(this, args);
17-
};
12+
return new Proxy(origDocumentGetInitialProps, {
13+
apply: async (wrappingTarget, thisArg, args: Parameters<DocumentGetInitialProps>) => {
14+
return await wrappingTarget.apply(thisArg, args);
15+
},
16+
});
1817
}
1918

2019
/**

packages/nextjs/src/client/wrapErrorGetInitialPropsWithSentry.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ type ErrorGetInitialProps = (context: NextPageContext) => Promise<ErrorProps>;
1010
export function wrapErrorGetInitialPropsWithSentry(
1111
origErrorGetInitialProps: ErrorGetInitialProps,
1212
): ErrorGetInitialProps {
13-
return async function (this: unknown, ...args: Parameters<ErrorGetInitialProps>): ReturnType<ErrorGetInitialProps> {
14-
return await origErrorGetInitialProps.apply(this, args);
15-
};
13+
return new Proxy(origErrorGetInitialProps, {
14+
apply: async (wrappingTarget, thisArg, args: Parameters<ErrorGetInitialProps>) => {
15+
return await wrappingTarget.apply(thisArg, args);
16+
},
17+
});
1618
}
1719

1820
/**

packages/nextjs/src/client/wrapGetInitialPropsWithSentry.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ type GetInitialProps = Required<NextPage>['getInitialProps'];
77
* so we are consistent with the serverside implementation.
88
*/
99
export function wrapGetInitialPropsWithSentry(origGetInitialProps: GetInitialProps): GetInitialProps {
10-
return async function (this: unknown, ...args: Parameters<GetInitialProps>): Promise<ReturnType<GetInitialProps>> {
11-
return origGetInitialProps.apply(this, args);
12-
};
10+
return new Proxy(origGetInitialProps, {
11+
apply: async (wrappingTarget, thisArg, args: Parameters<GetInitialProps>) => {
12+
return await wrappingTarget.apply(thisArg, args);
13+
},
14+
});
1315
}
1416

1517
/**

packages/nextjs/src/config/webpack.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,13 @@ function shouldAddSentryToEntryPoint(
473473
return entryPointName.startsWith('pages/');
474474
} else if (runtime === 'browser') {
475475
return (
476-
entryPointName === 'main' || // entrypoint for `/pages` pages
477-
entryPointName === 'main-app' // entrypoint for `/app` pages
476+
// entrypoint for `/pages` pages - this is included on all clientside pages
477+
// It's important that we inject the SDK into this file and not into 'main' because in 'main'
478+
// some important Next.js code (like the setup code for getCongig()) is located and some users
479+
// may need this code inside their Sentry configs
480+
entryPointName === 'pages/_app' ||
481+
// entrypoint for `/app` pages
482+
entryPointName === 'main-app'
478483
);
479484
} else {
480485
// User-specified pages to skip. (Note: For ease of use, `excludeServerRoutes` is specified in terms of routes,

packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,24 @@ export function wrapApiHandlerWithSentry<H extends EdgeRouteHandler>(
1010
handler: H,
1111
parameterizedRoute: string,
1212
): (...params: Parameters<H>) => Promise<ReturnType<H>> {
13-
return async function (this: unknown, ...args: Parameters<H>): Promise<ReturnType<H>> {
14-
const req = args[0];
13+
return new Proxy(handler, {
14+
apply: async (wrappingTarget, thisArg, args: Parameters<H>) => {
15+
const req = args[0];
1516

16-
const activeSpan = !!getCurrentHub().getScope()?.getSpan();
17+
const activeSpan = !!getCurrentHub().getScope()?.getSpan();
1718

18-
const wrappedHandler = withEdgeWrapping(handler, {
19-
spanDescription:
20-
activeSpan || !(req instanceof Request)
21-
? `handler (${parameterizedRoute})`
22-
: `${req.method} ${parameterizedRoute}`,
23-
spanOp: activeSpan ? 'function' : 'http.server',
24-
mechanismFunctionName: 'wrapApiHandlerWithSentry',
25-
});
19+
const wrappedHandler = withEdgeWrapping(wrappingTarget, {
20+
spanDescription:
21+
activeSpan || !(req instanceof Request)
22+
? `handler (${parameterizedRoute})`
23+
: `${req.method} ${parameterizedRoute}`,
24+
spanOp: activeSpan ? 'function' : 'http.server',
25+
mechanismFunctionName: 'wrapApiHandlerWithSentry',
26+
});
2627

27-
return await wrappedHandler.apply(this, args);
28-
};
28+
return await wrappedHandler.apply(thisArg, args);
29+
},
30+
});
2931
}
3032

3133
/**

packages/nextjs/src/edge/wrapMiddlewareWithSentry.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ import { withEdgeWrapping } from './utils/edgeWrapperUtils';
1010
export function wrapMiddlewareWithSentry<H extends EdgeRouteHandler>(
1111
middleware: H,
1212
): (...params: Parameters<H>) => Promise<ReturnType<H>> {
13-
return withEdgeWrapping(middleware, {
14-
spanDescription: 'middleware',
15-
spanOp: 'middleware.nextjs',
16-
mechanismFunctionName: 'withSentryMiddleware',
13+
return new Proxy(middleware, {
14+
apply: async (wrappingTarget, thisArg, args: Parameters<H>) => {
15+
return withEdgeWrapping(wrappingTarget, {
16+
spanDescription: 'middleware',
17+
spanOp: 'middleware.nextjs',
18+
mechanismFunctionName: 'withSentryMiddleware',
19+
}).apply(thisArg, args);
20+
},
1721
});
1822
}

packages/nextjs/src/server/utils/nextLogger.ts

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)