-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor the send payload function #203
Conversation
@sarveshnagpal could you please review this PR, here is an URL example that sendBeacon couldn't parse and throw a "TypeError" or "Illegal Invocation" exception in our prod app earlier today : |
if (dispatched) { done(sequence); } | ||
try { | ||
// sendBeacon must be binded to the navigator before passing the reference | ||
dispatched = navigator.sendBeacon.bind(navigator)(url, payload); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked up issue you referenced #194 - do you know if this is a Sentry problem? Looked up MDN: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon and it doesn't require binding to navigator before sending sendBeacon. If you could explain more that will help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sarveshnagpal I couldn't find more details also on the manner, but this fix is used to handle the error in popular frameworks like next.js, you can check this commit from the next.js repo , they had the same issue and fixed like I did.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sarveshnagpal here is the issue that mansions this in the next.js repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sentry also had the same issue and fixed it like that in this PR
@sarveshnagpal could you review this PR please, we are still receiving the error in PROD. |
* Perf improvement & bug fix to improve Angular SPA * Fixing lint errors * Bumping version to 0.6.32 * Bump shelljs from 0.8.4 to 0.8.5 (#209) Bumps [shelljs](https://github.com/shelljs/shelljs) from 0.8.4 to 0.8.5. - [Release notes](https://github.com/shelljs/shelljs/releases) - [Changelog](https://github.com/shelljs/shelljs/blob/master/CHANGELOG.md) - [Commits](shelljs/shelljs@v0.8.4...v0.8.5) --- updated-dependencies: - dependency-name: shelljs dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Refactor the send payload function (#203) * bind the sendBeacon to navigator before passing reference * surround the sendBeacon call with try catch bloc * removed console.error from catch bloc for performance reasons * Update packages and comments Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Djeghri Houssem <35101902+HoussemDjeghri@users.noreply.github.com>
This PR has 2 main changes:
This PR fixes the issue #194