Filter Dexie 'env' TypeError in Sentry - #386
Open
seer-by-sentry[bot] wants to merge 1 commit into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| const text = getEventErrorText(event) | ||
|
|
||
| if ( | ||
| text.includes("Cannot read properties of undefined (reading 'env')") || |
There was a problem hiding this comment.
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.
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.
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
unhandledrejectionand recovering in-memory. However, Sentry was still recording these events.The fix involves updating
src/lib/sentry/policy.tsto include this specific error message in theshouldDropClientEventfunction, ensuring it is filtered out before being sent to Sentry, consistent with how other benign Dexie/IndexedDB errors are already handled.Fixes WEBSITE-36