Files
Jordi Enric 15f80e5f9d fix(docs): restore browser crash reporting to sentry (#50231)
## Problem

Docs discarded every browser exception because its third-party
stack-frame filter never returned a value from its predicate. Errors
captured by the page error boundaries were discarded too.

## Fix

Use Studio's Sentry SDK tagging approach with a matching webpack
application key, retaining page-crashing exceptions even when their
frames are classified as third-party. Preserve consent and platform
checks, and pass the source-map upload token through Turbo.

## How to test

- Run `pnpm --filter docs run test:local:unwatch
lib/sentry-client.test.ts` with the documented local Supabase
prerequisites satisfied. Eleven filter regression checks passed locally
using an isolated Vitest configuration.
- On a production-mode preview with the docs DSN configured, accept
telemetry consent and trigger a temporary client render error. Verify
that the docs Sentry project receives it with `globalErrorBoundary:
true` and readable stack traces.
- Verify that third-party-only errors are filtered and declining consent
suppresses browser reports.

Prettier, focused filter/test TypeScript checks, and an in-memory
transport check using the real Sentry SDK passed. Full app typecheck and
lint are blocked locally by existing dependency/generated-file drift;
the standard docs suite requires unavailable Docker access. Live Sentry
ingestion and source-map uploads still need deployment verification.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved error monitoring to distinguish documentation app boundary
crashes from other exceptions.
- Reduced noise in error reports by filtering third-party-only errors
and respecting platform and consent settings.
- Preserved reporting for first-party failures and critical application
crashes.

- **Chores**
- Improved Sentry build and deployment configuration for more consistent
error tracking.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-11 12:48:33 +02:00

94 lines
3.2 KiB
JSON

{
"$schema": "./../../node_modules/turbo/schema.json",
"extends": ["//"],
"tasks": {
"codegen:examples": {
"inputs": ["../../examples/**"],
"outputs": ["examples/**"],
},
"codegen:references": {
"inputs": ["spec/**"],
"outputs": ["features/docs/generated/**"],
},
// Fetches remote (GitHub) content and the JSON artifacts the markdown generator reads.
// Not cached: the inputs are remote, so a cache restore could resurrect stale content.
"build:federated-content": {
"cache": false,
"env": [
"DOCS_GITHUB_APP_ID",
"DOCS_GITHUB_APP_INSTALLATION_ID",
"DOCS_GITHUB_APP_PRIVATE_KEY",
],
},
// Generates the guide/reference .md files and manifest.json under public/markdown/.
// Declaring outputs lets Turbo restore these artifacts on a cache hit; without it a
// cached run would skip the script and leave the generated markdown missing for `next build`.
"build:markdown": {
"dependsOn": ["build:federated-content"],
"outputs": ["public/markdown/**", "public/markdown/manifest.json"],
},
"test": {
// Lets the smoke tests target a preview deploy or localhost instead of production.
"env": ["DOCS_SMOKE_URL"],
},
"build": {
"dependsOn": ["^build", "codegen:examples", "codegen:references", "build:markdown"],
"env": [
"ANALYZE",
"NEXT_PUBLIC_SUPABASE_URL",
"NEXT_PUBLIC_SUPABASE_ANON_KEY",
"NEXT_PUBLIC_MISC_URL",
"NEXT_PUBLIC_MISC_ANON_KEY",
"NEXT_PUBLIC_MARKETPLACE_API_URL",
"NEXT_PUBLIC_MARKETPLACE_PUBLISHABLE_KEY",
"NODE_ENV",
"NEXT_PUBLIC_API_URL",
"NEXT_PUBLIC_BASE_PATH",
"NEXT_PUBLIC_SITE_URL",
"NEXT_PUBLIC_DEV_AUTH_PAGE",
"NEXT_PUBLIC_IS_PLATFORM",
"NEXT_PUBLIC_SENTRY_DSN",
"NEXT_PUBLIC_VERCEL_ENV",
"NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA",
"VERCEL",
"VERCEL_ENV",
"VERCEL_GIT_COMMIT_SHA",
"VERCEL_URL",
// These envs are used in the packages
"NEXT_PUBLIC_STORAGE_KEY",
"NEXT_PUBLIC_AUTH_DEBUG_KEY",
"NEXT_PUBLIC_AUTH_PERSISTED_KEY",
"NEXT_PUBLIC_AUTH_NAVIGATOR_LOCK_KEY",
"NEXT_PUBLIC_AUTH_DETECT_SESSION_IN_URL",
"NEXT_PUBLIC_GOOGLE_TAG_MANAGER_ID",
"NEXT_PUBLIC_GOTRUE_URL",
"NEXT_PUBLIC_SUPABASE_ANON_KEY",
"NEXT_PUBLIC_MCP_URL",
// These envs are technically passthrough env vars because they're only used on the server side of Nextjs
"ASSET_CDN_S3_ENDPOINT",
"AWS_ACCESS_KEY_ID",
"AWS_SECRET_ACCESS_KEY",
"CI",
"DOCS_GITHUB_APP_ID",
"DOCS_GITHUB_APP_INSTALLATION_ID",
"DOCS_GITHUB_APP_PRIVATE_KEY",
"DOCS_REVALIDATION_KEYS",
"DOCS_REVALIDATION_OVERRIDE_KEYS",
"ENABLED_FEATURES_OVERRIDE_DISABLE_ALL",
"GH_TOKEN",
"GITHUB_ACTIONS",
"GITHUB_TOKEN",
"FORCE_ASSET_CDN",
"LOGFLARE_INGESTION_API_KEY",
"LOGFLARE_SOURCE_TOKEN",
"OPENAI_API_KEY",
"SITE_NAME",
"SUPABASE_SECRET_KEY",
],
"passThroughEnv": ["SENTRY_AUTH_TOKEN"],
"inputs": ["$TURBO_DEFAULT$"],
"outputs": [".next/**", "!.next/cache/**"],
},
},
}