feat: disable Sentry in local development#2377
Merged
andrew-bierman merged 1 commit intoMay 17, 2026
Merged
Conversation
Copilot created this pull request from a session on behalf of
andrew-bierman
May 3, 2026 16:59
View session
Agent-Logs-Url: https://github.com/PackRat-AI/PackRat/sessions/6c2b7497-670d-4fbd-b361-aaceb9e4d994 Co-authored-by: andrew-bierman <94939237+andrew-bierman@users.noreply.github.com>
d40c546 to
b2eb71d
Compare
Contributor
Coverage Report for Expo Unit Tests Coverage (./apps/expo)
File CoverageNo changed files found. |
Contributor
Coverage Report for API Unit Tests Coverage (./packages/api)
File CoverageNo changed files found. |
Collaborator
|
Reviewed and verified — this is a clean fix:
Failed checks are the standard iOS/Android E2E flake — unrelated to this 4-file env-validation change. Marking ready. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent Sentry from capturing events during local development by relaxing API env validation around SENTRY_DSN and disabling the Sentry React Native SDK when running the Expo app in development (or without a DSN).
Changes:
- API: Make
SENTRY_DSNoptional inapiEnvSchemato avoid blocking localwrangler devruns. - Expo: Configure
Sentry.init({ enabled: ... })so Sentry becomes a no-op in development or when DSN is missing. - Tests: Add coverage asserting
SENTRY_DSNcan be missing in the API env schema.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/api/src/utils/env-validation.ts | Makes SENTRY_DSN optional in the API env schema. |
| packages/api/src/utils/tests/env-validation.test.ts | Adds a test asserting missing SENTRY_DSN is accepted. |
| apps/expo/app/_layout.tsx | Disables Sentry SDK via enabled flag in development / without DSN. |
| apps/expo/features/auth/hooks/useAuthActions.ts | Updates Google sign-in implementation (appears unrelated to Sentry-scoped PR description). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+91
to
+96
| const { data, error } = await authClient.signIn.social({ | ||
| provider: 'google', | ||
| idToken: { token: idToken }, | ||
| }); | ||
| if (error) throw new Error(error.message ?? t('auth.failedToSignInWithGoogle')); | ||
| if (data && 'user' in data && data.user) applySession(data.user as Record<string, unknown>); // safe-cast: Better Auth user type omits additionalFields; role/preferredWeightUnit present at runtime |
| expect(apiEnvSchema.shape.SENTRY_DSN.safeParse('not-a-url').success).toBe(false); | ||
| }); | ||
|
|
||
| it('accepts missing SENTRY_DSN for local development', () => { |
andrew-bierman
added a commit
that referenced
this pull request
May 17, 2026
Resolves conflicts arising from the recent merge of #2423 (computePackWeights return type changes, schema parsing) and #2377 (auth flow refactor). All resolutions preserve the single-object-param convention enforced by no-owned-max-params; absorbed dev's new return-type wrappers (Zod parse) and the authClient-based password reset flow. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
andrew-bierman
added a commit
that referenced
this pull request
May 17, 2026
… landed) Resolved 3 conflicts: - UserAvatar.tsx: absorbed dev's MockUser/avatarUrl refactor while preserving HEAD's Platform.select web-image shim. - TemplateItemsSection.tsx: dropped HEAD's redundant WeightUnit re-import (dev already imports from @packrat/constants); kept Platform import. - bun.lock: regenerated from dev's lockfile via bun install. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Prevents Sentry from capturing events during local development on both the API and Expo mobile app.
Changes
API –
packages/api/src/utils/env-validation.tsSENTRY_DSNwas a required field inapiEnvSchemaeven though the API never initialises the Sentry SDK — the var was only validated at startup. Made it optional so local.dev.varsfiles don't need a placeholder DSN, and developers aren't blocked by a missing env var when runningwrangler dev.Expo –
apps/expo/app/_layout.tsxAdded an
enabledflag toSentry.init():Sentry becomes a fully inert no-op SDK when:
NODE_ENVis'development'(local Expo dev server), orEXPO_PUBLIC_SENTRY_DSNis configuredAll other Sentry call-sites (
Sentry.wrap,Sentry.ErrorBoundary,Sentry.captureException) are untouched — when the SDK is initialised withenabled: falsethey are guaranteed no-ops by the Sentry SDK itself.Tests –
packages/api/src/utils/__tests__/env-validation.test.tsAdded a test that asserts
undefinedis now a valid value forSENTRY_DSNin the production schema, covering the new optional field.