From 511b3591c0c38e65a94a8284dfee6d8ef9469c33 Mon Sep 17 00:00:00 2001 From: Travis Vachon Date: Tue, 17 Dec 2024 15:07:39 -0800 Subject: [PATCH] fix: use the same Sentry project for different envs Sentry actually supports envs, which is useful when we start doing release notifications properly (which will give us source maps in Sentry) - use them! --- .env.tpl | 5 +++-- .github/workflows/deploy-storacha.yml | 10 ++-------- sentry.client.config.ts | 1 + sentry.edge.config.ts | 1 + sentry.server.config.ts | 1 + 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.env.tpl b/.env.tpl index f0d153b..e659641 100644 --- a/.env.tpl +++ b/.env.tpl @@ -17,6 +17,7 @@ NEXT_PUBLIC_REFERRAL_URL=http://localhost:3001/referred NEXT_PUBLIC_REFERRALS_SERVICE_URL=http://localhost:4001 # Sentry -NEXT_PUBLIC_SENTRY_DSN=https://cfd48360703c6ab11a8fa3285986b462@o609598.ingest.us.sentry.io/4508462420393984 +NEXT_PUBLIC_SENTRY_DSN=https://bf79c216fe3c72328219f04aabeebc99@o609598.ingest.us.sentry.io/4508456692940801 NEXT_PUBLIC_SENTRY_ORG=storacha-it -NEXT_PUBLIC_SENTRY_PROJECT=console-dev \ No newline at end of file +NEXT_PUBLIC_SENTRY_PROJECT=console +NEXT_PUBLIC_SENTRY_ENV=development diff --git a/.github/workflows/deploy-storacha.yml b/.github/workflows/deploy-storacha.yml index 1073a24..11fd1cf 100644 --- a/.github/workflows/deploy-storacha.yml +++ b/.github/workflows/deploy-storacha.yml @@ -44,13 +44,9 @@ jobs: echo "NEXT_PUBLIC_STRIPE_TRIAL_PRICING_TABLE_ID=prctbl_1QIDHGF6A5ufQX5vOK9Xl8Up" >> .env echo "NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_51LO87hF6A5ufQX5viNsPTbuErzfavdrEFoBuaJJPfoIhzQXdOUdefwL70YewaXA32ZrSRbK4U4fqebC7SVtyeNcz00qmgNgueC" >> .env echo "NEXT_PUBLIC_STRIPE_CUSTOMER_PORTAL_LINK=https://billing.stripe.com/p/login/test_6oE29Gff99KO6mk8ww" >> .env - echo "NEXT_PUBLIC_SENTRY_DSN=https://22f0c5668da78cb2a1b38efdd3e5b4f9@o609598.ingest.us.sentry.io/4508462417772544" >> .env - echo "NEXT_PUBLIC_SENTRY_ORG=storacha-it" >> .env - echo "NEXT_PUBLIC_SENTRY_PROJECT=console-staging" >> .env - - # use example.com in preview because we can't predict the preview URL of the storacha.network site echo "NEXT_PUBLIC_REFERRAL_URL=http://staging.storacha.network/referred" >> .env echo "NEXT_PUBLIC_REFERRALS_SERVICE_URL=https://staging-referrals.storacha.network" >> .env + echo "NEXT_PUBLIC_SENTRY_ENV=staging" >> .env # as long as this uses https://github.com/cloudflare/next-on-pages/blob/dc529d7efa8f8568ea8f71b5cdcf78df89be6c12/packages/next-on-pages/bin/index.js, # env vars won't get passed through to wrangler, so if wrangler will need them, write them to .env like the previous step - run: pnpm pages:build @@ -144,9 +140,7 @@ jobs: echo "NEXT_PUBLIC_STRIPE_CUSTOMER_PORTAL_LINK=https://billing.stripe.com/p/login/cN22aA62U6bO1sA9AA" >> .env echo "NEXT_PUBLIC_REFERRAL_URL=http://storacha.network/referred" >> .env echo "NEXT_PUBLIC_REFERRALS_SERVICE_URL=https://referrals.storacha.network" >> .env - echo "NEXT_PUBLIC_SENTRY_DSN=https://bf79c216fe3c72328219f04aabeebc99@o609598.ingest.us.sentry.io/4508456692940801" >> .env - echo "NEXT_PUBLIC_SENTRY_ORG=storacha-it" >> .env - echo "NEXT_PUBLIC_SENTRY_PROJECT=console" >> .env + echo "NEXT_PUBLIC_SENTRY_ENV=production" >> .env - run: pnpm pages:build # as long as this uses https://github.com/cloudflare/next-on-pages/blob/dc529d7efa8f8568ea8f71b5cdcf78df89be6c12/packages/next-on-pages/bin/index.js, # env vars won't get passed through to wrangler, so if wrangler will need them, write them to .env like the previous step diff --git a/sentry.client.config.ts b/sentry.client.config.ts index aea6296..95a62a0 100644 --- a/sentry.client.config.ts +++ b/sentry.client.config.ts @@ -6,6 +6,7 @@ import * as Sentry from "@sentry/nextjs"; Sentry.init({ dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, + environment: process.env.NEXT_PUBLIC_SENTRY_ENV, // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control. tracesSampleRate: 1, diff --git a/sentry.edge.config.ts b/sentry.edge.config.ts index 481fe5f..212ac4e 100644 --- a/sentry.edge.config.ts +++ b/sentry.edge.config.ts @@ -7,6 +7,7 @@ import * as Sentry from "@sentry/nextjs"; Sentry.init({ dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, + environment: process.env.NEXT_PUBLIC_SENTRY_ENV, // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control. tracesSampleRate: 1, diff --git a/sentry.server.config.ts b/sentry.server.config.ts index c756a12..10fbdfc 100644 --- a/sentry.server.config.ts +++ b/sentry.server.config.ts @@ -6,6 +6,7 @@ import * as Sentry from "@sentry/nextjs"; Sentry.init({ dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, + environment: process.env.NEXT_PUBLIC_SENTRY_ENV, // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control. tracesSampleRate: 1,