Skip to content

Filter Dexie 'env' TypeError in Sentry - #386

Open
seer-by-sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/sentry-dexie-env-error
Open

Filter Dexie 'env' TypeError in Sentry#386
seer-by-sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/sentry-dexie-env-error

Conversation

@seer-by-sentry

Copy link
Copy Markdown

This PR addresses WEBSITE-36 by preventing Sentry from capturing a specific Dexie TypeError: Cannot read properties of undefined (reading 'env').

This error occurs when IndexedDB is unavailable (e.g., in private browsing modes or with strict storage settings). The application already gracefully handles this scenario by catching the unhandledrejection and recovering in-memory. However, Sentry was still recording these events.

The fix involves updating src/lib/sentry/policy.ts to include this specific error message in the shouldDropClientEvent function, ensuring it is filtered out before being sent to Sentry, consistent with how other benign Dexie/IndexedDB errors are already handled.

Fixes WEBSITE-36

@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
raid-hub Ready Ready Preview Jul 10, 2026 11:02pm

Request Review

Comment thread src/lib/sentry/policy.ts
const text = getEventErrorText(event)

if (
text.includes("Cannot read properties of undefined (reading 'env')") ||

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The new error filter for "Cannot read properties of undefined (reading 'env')" is too generic and lacks a !hasAppStackFrame guard, potentially suppressing legitimate application errors.
Severity: MEDIUM

Suggested Fix

Guard the new filter with a !hasAppStackFrame check to ensure it only applies to non-application code, which is consistent with other filters in the function. Alternatively, make the filter more specific to Dexie errors by checking for additional context.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: src/lib/sentry/policy.ts#L374

Potential issue: The new filter added to `shouldDropClientEvent` to drop events with the
message `"Cannot read properties of undefined (reading 'env')"` is overly broad. Because
it lacks a `!hasAppStackFrame` guard, it will suppress any error with this message, even
if it originates from the application's own code. This violates the function's
documented purpose of allowing app-frame errors through for debugging. While intended to
filter noise from Dexie/IndexedDB based on an issue
([WEBSITE-36](https://raidhub.sentry.io/issues/integer_issue_id)), this generic filter
could inadvertently hide real bugs in the application that happen to produce the same
error message.

Did we get this right? 👍 / 👎 to inform future reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants