Skip to content

FE-M0-19 · Pack F on the production address: a test error in Sentry

ID FE-M0-19 · Level L0 · Run order row 34a · Why D24, D15

Pack F, merged in #237, is deployed by Vercel with the Sentry variables from TL-M0-22. From the production address, a test error from the browser and one from the server arrive in Sentry's opleet-web project with environment staging, a readable stack trace that names the app's own files, and no IP address, cookie or query string. The production build uploaded its source maps, and the browser can't download them.

  • FE-M0-18 is Done, with a clean run of FE-M0-17 and FE-M0-18 logged on #173. Pack F is merged (#237).
  • TL-M0-22 is Done: the five Sentry variables are in Vercel, and the token is on Production only.
  • TL-M0-21 is Done: merging to main deploys the production address, below <VERCEL_URL>.
  • Staging has the E2E logins (BE-M0-30). This step signs in as the E2E super_admin login, with the password in .env.e2e.
Terminal window
git switch main
git pull
git log --oneline --grep 'report errors to sentry' -1

2 · In Vercel, open Deployments › the newest Production deployment, which is main's head (pack F's commit or a later one) › Build Logs. Search the log for “Sentry”.

Section titled “2 · In Vercel, open Deployments › the newest Production deployment, which is main's head (pack F's commit or a later one) › Build Logs. Search the log for “Sentry”.”

3 · In the browser, open https://<VERCEL_URL>/system/sentry, sign in as the E2E super_admin login, and open the page again. Press “Error di browser”. Then press “Error di server”.

Section titled “3 · In the browser, open https://<VERCEL_URL>/system/sentry, sign in as the E2E super_admin login, and open the page again. Press “Error di browser”. Then press “Error di server”.”

4 · In Sentry, open Issues with the project filter set to opleet-web and the time range set to the last hour. Open each of the two new issues.

Section titled “4 · In Sentry, open Issues with the project filter set to opleet-web and the time range set to the last hour. Open each of the two new issues.”

5 · Check that the browser can't download a source map. In the browser's Network tab, copy the address of any script under /_next/static/chunks/ and add .map to it

Section titled “5 · Check that the browser can't download a source map. In the browser's Network tab, copy the address of any script under /_next/static/chunks/ and add .map to it”
Terminal window
curl -s -o /dev/null -w "%{http_code}\n" "<SCRIPT_URL>.map"
  • Block 1: “a10ef4a feat(web): report errors to sentry, with personal data kept out (d24) (#237)”.
  • Block 2: the build passes, and its log has lines from @sentry/nextjs - After Production Compile about the release and the source maps it uploaded, with no error.
  • Block 3: the page says “Sentry aktif, lingkungan staging.” “Error di browser” shows nothing on the page. “Error di server” shows “Error server sudah terjadi. Periksa Sentry.” under the button, and the page stays.
  • Block 4: “FE pack F: a test error from the browser” and “FE pack F: a test error from the server”, each with environment staging. The stack trace names the app's own files, such as app/(shell)/system/sentry/test-buttons.tsx and app/(shell)/system/sentry/actions.ts, not only /_next/static/chunks/…. The event's Request section has the path and, for the server's, the method, and nothing else: no cookies, no headers, no query string. There is no User section with an IP address.
  • Block 5: 404.

In Sentry, open Settings › Projects › opleet-web › Source Maps › Artifact Bundles (or Releases › the newest release): an upload from the newest production build. Then select both test issues and choose Resolve.

Log the run on #173: the date, the pull request number, the two issues' titles with their environment, one line of each stack trace that names an app file, and block 5's status code. Never paste the DSN, the token or a password.

  • The page says “Sentry tidak aktif”: NEXT_PUBLIC_SENTRY_DSN is not on Production, or it was added after this build. Check TL-M0-22 block 7, then Deployments › the latest › Redeploy with the build cache off.
  • No issue after five minutes: check Issues' filters (opleet-web, all environments, last hour), then Stats › Usage for dropped events. An ad blocker in the browser can drop the browser's event: try a private window without extensions. Paste what Usage shows.
  • The stack trace shows only /_next/static/chunks/…: no source maps were uploaded. Paste the build log's lines that mention Sentry. A 401 or 403 there means SENTRY_AUTH_TOKEN is wrong or missing on Production (TL-M0-22 blocks 6 and 7).
  • The Request section shows cookies or headers, or the URL has a query string: stop, and paste the event's JSON (the ⋯ menu › JSON) with the cookie values cut out. lib/sentry/options.ts must remove them.
  • Block 5 prints 200: a source map is public. Stop and paste the URL. The build must delete them after the upload.

Revert the pull request with a new one. The SDK then stops on the next deployment; the issues stay in Sentry until they are deleted there.

Not run yet. Log each run as a comment on #173.