Skip to content

fix(ethicalads): Handle SyntaxError from empty selector in Safari - #444

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/ethicalads-syntax-error
Open

sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/ethicalads-syntax-error

Conversation

@sentry

@sentry sentry Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

This PR addresses a SyntaxError: '' is not a valid selector. that occurred in Safari 26.6 when window.ethicalads.reload() was called. The error originated from the third-party ethicalads.min.js library internally calling document.querySelectorAll('') with an empty selector string, which Safari considers invalid.

The issue manifested as an unhandled Promise rejection because the call to window.ethicalads.reload() in src/components/EthicalAds.tsx did not include a .catch() handler.

Changes made:

  1. src/components/EthicalAds.tsx: Modified window.ethicalads.reload(); to window.ethicalads.reload().catch(function() {}); to gracefully handle the Promise rejection and prevent it from becoming an unhandled error.
  2. src/lib/sentry-filter.ts: Added a new filter rule to suppress Sentry events for SyntaxError with the message '' is not a valid selector. This acts as a safety net to prevent similar errors from being reported in the future, especially if they originate from different contexts or browsers.

Fixes BLOG-6C

This PR was automatically generated by Sentry. You can adjust this setting at any time.

This branch has not been deployed

No deployments
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