Skip to content

Commit c7d69b6

Browse files
authored
fix(nextjs): Export showReportDialog from NextJS SDK (#5242)
1 parent 838dcfb commit c7d69b6

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

packages/nextjs/src/index.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export * from '@sentry/node';
1515

1616
// Here we want to make sure to only include what doesn't have browser specifics
1717
// because or SSR of next.js we can only use this.
18-
export { ErrorBoundary, withErrorBoundary } from '@sentry/react';
18+
export { ErrorBoundary, showReportDialog, withErrorBoundary } from '@sentry/react';
1919

2020
type GlobalWithDistDir = typeof global & { __rewriteFramesDistDir__: string };
2121
const domain = domainModule as typeof domainModule & { active: (domainModule.Domain & Carrier) | null };
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { showReportDialog } from '@sentry/nextjs';
2+
3+
const ReportDialogPage = (): JSX.Element => (
4+
<button
5+
onClick={() => {
6+
showReportDialog();
7+
}}
8+
>
9+
Open Report Dialog
10+
</button>
11+
);
12+
13+
export default ReportDialogPage;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const assert = require('assert');
2+
3+
module.exports = async ({ page, url }) => {
4+
await page.goto(`${url}/reportDialog`);
5+
6+
await page.click('button');
7+
8+
const dialogScriptSelector = 'head > script[src^="https://dsn.ingest.sentry.io/api/embed/error-page"]';
9+
10+
const dialogScript = await page.waitForSelector(dialogScriptSelector, { state: 'attached' });
11+
const dialogScriptSrc = await (await dialogScript.getProperty('src')).jsonValue();
12+
13+
assert(dialogScriptSrc.startsWith('https://dsn.ingest.sentry.io/api/embed/error-page/?'));
14+
};

0 commit comments

Comments
 (0)