Skip to content

Commit d241842

Browse files
committed
feat: add sentry error tracking
We need to track down some persistent errors in the app, and should have better visibility in general into web client performance - this will help with both. Staging/prod configuration are included in the build script here, and I've configured separate projects for dev/staging/prod in Sentry.
1 parent 0ce071e commit d241842

13 files changed

+2081
-40
lines changed

.env.tpl

+6-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,9 @@ NEXT_PUBLIC_DISABLE_PLAN_GATE=false
1414

1515
# point these at the marketing website and referrals service
1616
NEXT_PUBLIC_REFERRAL_URL=http://localhost:3001/referred
17-
NEXT_PUBLIC_REFERRALS_SERVICE_URL=http://localhost:4001
17+
NEXT_PUBLIC_REFERRALS_SERVICE_URL=http://localhost:4001
18+
19+
# Sentry
20+
NEXT_PUBLIC_SENTRY_DSN=https://[email protected]/4508462420393984
21+
NEXT_PUBLIC_SENTRY_ORG=storacha-it
22+
NEXT_PUBLIC_SENTRY_PROJECT=console-dev

.github/workflows/deploy-storacha.yml

+6
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ jobs:
4444
echo "NEXT_PUBLIC_STRIPE_TRIAL_PRICING_TABLE_ID=prctbl_1QIDHGF6A5ufQX5vOK9Xl8Up" >> .env
4545
echo "NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_51LO87hF6A5ufQX5viNsPTbuErzfavdrEFoBuaJJPfoIhzQXdOUdefwL70YewaXA32ZrSRbK4U4fqebC7SVtyeNcz00qmgNgueC" >> .env
4646
echo "NEXT_PUBLIC_STRIPE_CUSTOMER_PORTAL_LINK=https://billing.stripe.com/p/login/test_6oE29Gff99KO6mk8ww" >> .env
47+
echo "NEXT_PUBLIC_SENTRY_DSN=https://[email protected]/4508462417772544" >> .env
48+
echo "NEXT_PUBLIC_SENTRY_ORG=storacha-it" >> .env
49+
echo "NEXT_PUBLIC_SENTRY_PROJECT=console-staging" >> .env
4750
4851
# use example.com in preview because we can't predict the preview URL of the storacha.network site
4952
echo "NEXT_PUBLIC_REFERRAL_URL=http://staging.storacha.network/referred" >> .env
@@ -141,6 +144,9 @@ jobs:
141144
echo "NEXT_PUBLIC_STRIPE_CUSTOMER_PORTAL_LINK=https://billing.stripe.com/p/login/cN22aA62U6bO1sA9AA" >> .env
142145
echo "NEXT_PUBLIC_REFERRAL_URL=http://storacha.network/referred" >> .env
143146
echo "NEXT_PUBLIC_REFERRALS_SERVICE_URL=https://referrals.storacha.network" >> .env
147+
echo "NEXT_PUBLIC_SENTRY_DSN=https://[email protected]/4508456692940801" >> .env
148+
echo "NEXT_PUBLIC_SENTRY_ORG=storacha-it" >> .env
149+
echo "NEXT_PUBLIC_SENTRY_PROJECT=console" >> .env
144150
- run: pnpm pages:build
145151
# as long as this uses https://github.com/cloudflare/next-on-pages/blob/dc529d7efa8f8568ea8f71b5cdcf78df89be6c12/packages/next-on-pages/bin/index.js,
146152
# env vars won't get passed through to wrangler, so if wrangler will need them, write them to .env like the previous step

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ yarn-error.log*
3535
# typescript
3636
*.tsbuildinfo
3737
next-env.d.ts
38+
39+
# Sentry Config File
40+
.env.sentry-build-plugin

next.config.js

+42
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,45 @@ const nextConfig = {
66
}
77

88
module.exports = nextConfig
9+
10+
11+
// Injected content via Sentry wizard below
12+
13+
const { withSentryConfig } = require("@sentry/nextjs");
14+
15+
module.exports = withSentryConfig(
16+
module.exports,
17+
{
18+
// For all available options, see:
19+
// https://github.com/getsentry/sentry-webpack-plugin#options
20+
21+
org: process.env.NEXT_PUBLIC_SENTRY_ORG,
22+
project: process.env.NEXT_PUBLIC_SENTRY_PROJECT,
23+
24+
// Only print logs for uploading source maps in CI
25+
silent: !process.env.CI,
26+
27+
// For all available options, see:
28+
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
29+
30+
// Upload a larger set of source maps for prettier stack traces (increases build time)
31+
widenClientFileUpload: true,
32+
33+
// Automatically annotate React components to show their full name in breadcrumbs and session replay
34+
reactComponentAnnotation: {
35+
enabled: true,
36+
},
37+
38+
// Uncomment to route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
39+
// This can increase your server load as well as your hosting bill.
40+
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
41+
// side errors will fail.
42+
// tunnelRoute: "/monitoring",
43+
44+
// Hides source maps from generated client bundles
45+
hideSourceMaps: true,
46+
47+
// Automatically tree-shake Sentry logger statements to reduce bundle size
48+
disableLogger: true,
49+
}
50+
);

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"@ipld/car": "^5.2.4",
2020
"@ipld/dag-json": "^10.2.2",
2121
"@ipld/dag-ucan": "^3.4.0",
22+
"@sentry/nextjs": "^8",
2223
"@ucanto/client": "^9.0.1",
2324
"@ucanto/core": "^10.0.1",
2425
"@ucanto/interface": "^10.0.1",

0 commit comments

Comments
 (0)