Skip to content

Commit a350c87

Browse files
committed
fix merge
2 parents 6e65756 + adc9723 commit a350c87

File tree

16 files changed

+1389
-164
lines changed

16 files changed

+1389
-164
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ yarn-error.log*
3737
next-env.d.ts
3838
public/sw.js.map
3939
public/workbox*
40+
41+
# Sentry Config File
42+
.env.sentry-build-plugin

next.config.js

+39-12
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
const { withSentryConfig } = require("@sentry/nextjs");
2+
13
const path = require("path");
24
const withPWA = require("next-pwa")({
35
dest: "public"
46
});
5-
const { BugsnagBuildReporterPlugin } = require("webpack-bugsnag-plugins");
67
const appPackage = require("./package.json");
78

89
const config = {
@@ -19,15 +20,6 @@ const config = {
1920
}
2021
});
2122

22-
if (process.env.NODE_ENV === "production") {
23-
config.plugins.push(
24-
new BugsnagBuildReporterPlugin({
25-
apiKey: "53c03fdd42cd699cb95f60abe77a5b19",
26-
appVersion: appPackage.version
27-
})
28-
);
29-
}
30-
3123
return config;
3224
},
3325
images: {
@@ -55,6 +47,41 @@ const config = {
5547
}
5648
};
5749

50+
const withSentry = withSentryConfig(config, {
51+
// For all available options, see:
52+
// https://github.com/getsentry/sentry-webpack-plugin#options
53+
54+
org: "ildar-timerbaev",
55+
project: "ecency-next",
56+
57+
// Only print logs for uploading source maps in CI
58+
silent: !process.env.CI,
59+
60+
// For all available options, see:
61+
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
62+
63+
// Upload a larger set of source maps for prettier stack traces (increases build time)
64+
widenClientFileUpload: true,
65+
66+
// Uncomment to route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
67+
// This can increase your server load as well as your hosting bill.
68+
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
69+
// side errors will fail.
70+
// tunnelRoute: "/monitoring",
71+
72+
// Hides source maps from generated client bundles
73+
hideSourceMaps: true,
74+
75+
// Automatically tree-shake Sentry logger statements to reduce bundle size
76+
disableLogger: true,
77+
78+
// Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
79+
// See the following for more information:
80+
// https://docs.sentry.io/product/crons/
81+
// https://vercel.com/docs/cron-jobs
82+
automaticVercelMonitors: false
83+
});
84+
5885
/** @type {import('next').NextConfig} */
59-
const nextWithPWA = withPWA(config);
60-
module.exports = process.env.NODE_ENV === "production" ? nextWithPWA : config;
86+
const nextWithPWA = withPWA(withSentry);
87+
module.exports = process.env.NODE_ENV === "production" ? nextWithPWA : withSentry;

package.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
"test": "jest"
1111
},
1212
"dependencies": {
13-
"@bugsnag/browser-performance": "^2.9.0",
14-
"@bugsnag/js": "^8.0.0",
15-
"@bugsnag/plugin-react": "^8.0.0",
1613
"@ecency/ns-query": "^1.2.11-next",
1714
"@ecency/render-helper": "^2.2.29",
1815
"@emoji-mart/data": "^1.1.2",
@@ -24,6 +21,7 @@
2421
"@hiveio/hivescript": "^1.3.3",
2522
"@popperjs/core": "^2.11.8",
2623
"@react-spring/web": "^9.7.3",
24+
"@sentry/nextjs": "^8",
2725
"@tanstack/react-query": "^5.15.0",
2826
"@tanstack/react-query-devtools": "^5.15.0",
2927
"@tooni/iconscout-unicons-react": "^1.0.1",

public/sw.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/sw.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/workbox-9b4d2a02.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sentry.client.config.ts

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// This file configures the initialization of Sentry on the client.
2+
// The config you add here will be used whenever a users loads a page in their browser.
3+
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
4+
5+
import * as Sentry from "@sentry/nextjs";
6+
7+
Sentry.init({
8+
dsn: "https://8a5c1659d1c2ba3385be28dc7235ce56@o4507985141956608.ingest.de.sentry.io/4507985146609744",
9+
10+
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
11+
tracesSampleRate: 1,
12+
13+
// Setting this option to true will print useful information to the console while you're setting up Sentry.
14+
debug: false,
15+
});

sentry.edge.config.ts

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).
2+
// The config you add here will be used whenever one of the edge features is loaded.
3+
// Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.
4+
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
5+
6+
import * as Sentry from "@sentry/nextjs";
7+
8+
Sentry.init({
9+
dsn: "https://8a5c1659d1c2ba3385be28dc7235ce56@o4507985141956608.ingest.de.sentry.io/4507985146609744",
10+
11+
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
12+
tracesSampleRate: 1,
13+
14+
// Setting this option to true will print useful information to the console while you're setting up Sentry.
15+
debug: false,
16+
});

sentry.server.config.ts

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// This file configures the initialization of Sentry on the server.
2+
// The config you add here will be used whenever the server handles a request.
3+
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
4+
5+
import * as Sentry from "@sentry/nextjs";
6+
7+
Sentry.init({
8+
dsn: "https://8a5c1659d1c2ba3385be28dc7235ce56@o4507985141956608.ingest.de.sentry.io/4507985146609744",
9+
10+
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
11+
tracesSampleRate: 1,
12+
13+
// Setting this option to true will print useful information to the console while you're setting up Sentry.
14+
debug: false,
15+
});
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { NextResponse } from "next/server";
2+
3+
export const dynamic = "force-dynamic";
4+
5+
// A faulty API route to test Sentry's error monitoring
6+
export function GET() {
7+
throw new Error("Sentry Example API Route Error");
8+
return NextResponse.json({ data: "Testing Sentry Error..." });
9+
}

src/app/sentry-example-page/page.tsx

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
"use client";
2+
3+
import Head from "next/head";
4+
import * as Sentry from "@sentry/nextjs";
5+
6+
export default function Page() {
7+
return (
8+
<div>
9+
<Head>
10+
<title>Sentry Onboarding</title>
11+
<meta name="description" content="Test Sentry for your Next.js app!" />
12+
</Head>
13+
14+
<main
15+
style={{
16+
minHeight: "100vh",
17+
display: "flex",
18+
flexDirection: "column",
19+
justifyContent: "center",
20+
alignItems: "center",
21+
}}
22+
>
23+
<h1 style={{ fontSize: "4rem", margin: "14px 0" }}>
24+
<svg
25+
style={{
26+
height: "1em",
27+
}}
28+
xmlns="http://www.w3.org/2000/svg"
29+
viewBox="0 0 200 44"
30+
>
31+
<path
32+
fill="currentColor"
33+
d="M124.32,28.28,109.56,9.22h-3.68V34.77h3.73V15.19l15.18,19.58h3.26V9.22h-3.73ZM87.15,23.54h13.23V20.22H87.14V12.53h14.93V9.21H83.34V34.77h18.92V31.45H87.14ZM71.59,20.3h0C66.44,19.06,65,18.08,65,15.7c0-2.14,1.89-3.59,4.71-3.59a12.06,12.06,0,0,1,7.07,2.55l2-2.83a14.1,14.1,0,0,0-9-3c-5.06,0-8.59,3-8.59,7.27,0,4.6,3,6.19,8.46,7.52C74.51,24.74,76,25.78,76,28.11s-2,3.77-5.09,3.77a12.34,12.34,0,0,1-8.3-3.26l-2.25,2.69a15.94,15.94,0,0,0,10.42,3.85c5.48,0,9-2.95,9-7.51C79.75,23.79,77.47,21.72,71.59,20.3ZM195.7,9.22l-7.69,12-7.64-12h-4.46L186,24.67V34.78h3.84V24.55L200,9.22Zm-64.63,3.46h8.37v22.1h3.84V12.68h8.37V9.22H131.08ZM169.41,24.8c3.86-1.07,6-3.77,6-7.63,0-4.91-3.59-8-9.38-8H154.67V34.76h3.8V25.58h6.45l6.48,9.2h4.44l-7-9.82Zm-10.95-2.5V12.6h7.17c3.74,0,5.88,1.77,5.88,4.84s-2.29,4.86-5.84,4.86Z M29,2.26a4.67,4.67,0,0,0-8,0L14.42,13.53A32.21,32.21,0,0,1,32.17,40.19H27.55A27.68,27.68,0,0,0,12.09,17.47L6,28a15.92,15.92,0,0,1,9.23,12.17H4.62A.76.76,0,0,1,4,39.06l2.94-5a10.74,10.74,0,0,0-3.36-1.9l-2.91,5a4.54,4.54,0,0,0,1.69,6.24A4.66,4.66,0,0,0,4.62,44H19.15a19.4,19.4,0,0,0-8-17.31l2.31-4A23.87,23.87,0,0,1,23.76,44H36.07a35.88,35.88,0,0,0-16.41-31.8l4.67-8a.77.77,0,0,1,1.05-.27c.53.29,20.29,34.77,20.66,35.17a.76.76,0,0,1-.68,1.13H40.6q.09,1.91,0,3.81h4.78A4.59,4.59,0,0,0,50,39.43a4.49,4.49,0,0,0-.62-2.28Z"
34+
></path>
35+
</svg>
36+
</h1>
37+
38+
<p>Get started by sending us a sample error:</p>
39+
<button
40+
type="button"
41+
style={{
42+
padding: "12px",
43+
cursor: "pointer",
44+
backgroundColor: "#AD6CAA",
45+
borderRadius: "4px",
46+
border: "none",
47+
color: "white",
48+
fontSize: "14px",
49+
margin: "18px",
50+
}}
51+
onClick={async () => {
52+
await Sentry.startSpan({
53+
name: 'Example Frontend Span',
54+
op: 'test'
55+
}, async () => {
56+
const res = await fetch("/api/sentry-example-api");
57+
if (!res.ok) {
58+
throw new Error("Sentry Example Frontend Error");
59+
}
60+
});
61+
}}
62+
>
63+
Throw error!
64+
</button>
65+
66+
<p>
67+
Next, look for the error on the{" "}
68+
<a href="https://ildar-timerbaev.sentry.io/issues/?project=4507985146609744">Issues Page</a>.
69+
</p>
70+
<p style={{ marginTop: "24px" }}>
71+
For more information, see{" "}
72+
<a href="https://docs.sentry.io/platforms/javascript/guides/nextjs/">
73+
https://docs.sentry.io/platforms/javascript/guides/nextjs/
74+
</a>
75+
</p>
76+
</main>
77+
</div>
78+
);
79+
}

src/features/bugsnag.tsx

-26
This file was deleted.

src/features/shared/notifications/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function NotificationsDialog({ openLinksInNewTab = false }: Props) {
2929
condition={({ visionFeatures }) => visionFeatures.notifications.enabled}
3030
>
3131
<ModalSidebar
32-
className="notifications-modal min-w-[32rem]"
32+
className="notifications-modal min-w-[90%] md:min-w-[32rem] [&_.ecency-sidebar]:overflow-hidden"
3333
show={show}
3434
setShow={(v) => {
3535
setShow(v);

src/features/ui/modal/modal-sidebar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function ModalSidebar({
3434
x: (placement === "right" ? 1 : -1) * 320
3535
}}
3636
className={classNameObject({
37-
"h-full-dynamic overflow-y-auto no-scrollbar bg-white dark:bg-dark-700 absolute w-[20rem] top-0 bottom-0":
37+
"ecency-sidebar h-full-dynamic overflow-y-auto no-scrollbar bg-white dark:bg-dark-700 absolute w-[20rem] top-0 bottom-0":
3838
true,
3939
"right-0 rounded-l-2xl": placement === "right",
4040
"left-0 rounded-r-2xl": placement === "left",

src/instrumentation.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import * as Sentry from '@sentry/nextjs';
2+
3+
export async function register() {
4+
if (process.env.NEXT_RUNTIME === 'nodejs') {
5+
await import('../sentry.server.config');
6+
}
7+
8+
if (process.env.NEXT_RUNTIME === 'edge') {
9+
await import('../sentry.edge.config');
10+
}
11+
}
12+
13+
export const onRequestError = Sentry.captureRequestError;

0 commit comments

Comments
 (0)