Skip to content

fix: identify and updateContact reject with an Error; version 19.9.1 - #231

Merged
boehlerlukas merged 4 commits into
masterfrom
fix/reject-with-error
Nov 24, 2026
Merged

boehlerlukas merged 4 commits into
masterfrom
fix/reject-with-error

Conversation

@LucaB01

@LucaB01 LucaB01 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Problem

When Gleap.identify, Gleap.updateContact or a product tour request fails (user offline, tab closing, ad blocker), the promise rejected with undefined or 'Session not ready yet.'. Apps that don't catch it get a Bugsnag/Sentry event "unhandledrejection handler received a non-error", with no message and no stack. A customer reported this.

Fix

  • These promises now reject with an Error that names the call and the reason: Gleap updateContact failed: network error, Gleap identify failed: HTTP 500, Gleap identify failed: refused (token_invalid).
  • Status 0 counts as network error, because browsers end a failed request with status 0 before the error event fires.
  • A logout while identify or updateContact is still on its way resolves instead of rejecting. It is not a failure.
  • A product tour that is not live on the page no longer writes to console.error.
  • The setUserJwt warning keeps its short reason.
  • CHANGELOG: an Unreleased entry. No version bump.

Tests

  • npx vitest run: 1053 passed.
  • The test mock's error() now ends with status 0 first, like a browser.
  • New tests cover a network error, HTTP 500, the refusal code, and a logout while a request is on its way.
  • Release review (2 reviewers): all should-fix items are done.

🤖 Generated with Claude Code

LucaB01 and others added 3 commits November 24, 2026 09:20
Failed identify, updateContact and product tour requests rejected with
undefined or a string, which Bugsnag and Sentry report as a non-error
unhandled rejection with no message. They now reject with an Error that
names the call and the reason (network error, HTTP status, refusal code).
A logout while a request is on its way resolves instead of rejecting.
A product tour that is not live on the page no longer logs console.error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r, setStyles types)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LucaB01 LucaB01 changed the title fix: identify and updateContact reject with an Error fix: identify and updateContact reject with an Error; version 19.9.1 Nov 24, 2026
- setLanguage catches the updateContact it makes itself, so a failed
  request never becomes an unhandled rejection the host app can't catch.
- requestError marks the Error with gleapReason; setUserJwt logs that
  reason instead of a stale lastIdentifyFailure.
- Product tours stay quiet for failed Gleap requests but still log real
  errors thrown by start().
- CHANGELOG: catch with Promise.resolve(...), since identify and
  updateContact return nothing when there is nothing to send.
- Rebuilt 19.9.1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@boehlerlukas
boehlerlukas merged commit d3fbe3d into master Nov 24, 2026
2 checks passed
@boehlerlukas
boehlerlukas deleted the fix/reject-with-error branch November 24, 2026 08:58
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.

2 participants