Skip to content

Sentry Browser SyntaxError on Safari <16.4 #20433

@stephenliang

Description

@stephenliang

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/browser

SDK Version

10.49.0

Framework Version

No response

Link to Sentry event

No response

Reproduction Example/SDK Setup

SDK Setup

Steps to Reproduce

  1. Load page using Safari 15

Expected Result

Page loads and sentry initializes

Actual Result

The bundle in which Sentry is in errors out due to syntax error (in our case it's the full page)

Additional Context

Note: we do not use the Postgres integration.

When using Sentry's CommonJS imports, it unconditionally requires the postgres integration at module load time (this is because of the export which becomes a require). The postgres integration contains a regex literal with a negative lookbehind assertion inside sanitizeSqlQuery

.replace(/(?<!\$)-?\b\d+\b/g, '?') // Integers (NOT $n placeholders)

Lookbehind assertions are not supported in Safari 15 or iOS Safari < 16.4. Because this is a regex literal, the JavaScript parser rejects it at parse time, before any code executes. A SyntaxError at parse time kills the entire JS file.

The result: any bundle that includes @sentry/core via CJS becomes unparseable on Safari 15, even if the application never imports or uses the postgres integration.

Per Sentry's supported browser page, Safari is supported down to 14.

Pinning Sentry to 10.40.0 fixes the issue.

Priority

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions