hyperdxio / hyperdxio/hyperdx-js
Permissions policy violation: unload event listener triggers Chrome warning
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 25
- Forks
- 30
- Avg merge
- 4h 26m
- Merged PRs (30d)
- 6
Description
Description
The @hyperdx/browser package registers a window.addEventListener("unload", ...) listener in its log exporter, which triggers a Chrome Permissions Policy violation:
[Violation] Permissions policy violation: unload is not allowed in this document.
This occurs on every page load when the HyperDX browser SDK is initialized.
Location
The offending code is in the bundled log exporter, which contains:
window.addEventListener("unload", (() => {
// flush logs
}));
There is also a beforeunload listener in the page-visibility instrumentation.
Context
Chrome has been deprecating the unload event and enforcing it via Permissions Policy. The unload event is unreliable on mobile and modern browsers increasingly block it entirely.
The library already registers pagehide and visibilitychange listeners elsewhere, which are the recommended replacements.
Expected Behavior
The SDK should not register unload event listeners. The log flush on page exit should use visibilitychange (with document.visibilityState === 'hidden') or pagehide instead, which the library already uses in other places.
Environment
@hyperdx/browser:^0.22.0- Chrome 133+
- Nuxt 4 SSR application
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the bundled log exporter and the page-visibility instrumentation described in the issue to their TypeScript source. Review the existing pagehide and visibilitychange handlers, then verify that the SDK no longer registers unload or beforeunload listeners while preserving log flushing on page exit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, observability
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100