fix: confirm ratio drop alert - #1522
Open
AbhishekChorotiya wants to merge 4 commits into
Open
Conversation
AbhishekChorotiya
had a problem deploying
to
Testing
April 29, 2026 09:35 — with
GitHub Actions
Failure
AbhishekChorotiya
force-pushed
the
fix/confirm_ratio_drop_alert
branch
from
April 29, 2026 09:43
ad98e99 to
815cae4
Compare
AbhishekChorotiya
had a problem deploying
to
Testing
April 29, 2026 09:43 — with
GitHub Actions
Failure
aritro2002
approved these changes
Apr 29, 2026
sakksham7
approved these changes
Apr 30, 2026
ArushKapoorJuspay
had a problem deploying
to
Testing
May 7, 2026 09:23 — with
GitHub Actions
Failure
AbhishekChorotiya
temporarily deployed
to
Testing
July 17, 2026 09:36 — with
GitHub Actions
Inactive
AbhishekChorotiya
temporarily deployed
to
Testing
July 17, 2026 09:36 — with
GitHub Actions
Inactive
AbhishekChorotiya
had a problem deploying
to
Testing
July 17, 2026 09:36 — with
GitHub Actions
Failure
AbhishekChorotiya
temporarily deployed
to
Testing
July 17, 2026 09:36 — with
GitHub Actions
Inactive
AbhishekChorotiya
temporarily deployed
to
Testing
July 17, 2026 09:36 — with
GitHub Actions
Inactive
AbhishekChorotiya
had a problem deploying
to
Testing
July 17, 2026 09:36 — with
GitHub Actions
Failure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
Fixes #1521
The
CONFIRM_CALLlog event was not being reliably sent to the logging server. On Safari it was never sent, and on other browsers it was intermittently missing.Root Cause
inside
sendLogsOverNetwork(),sendCachedLogsFromIDB()was beingawait-ed beforebeaconApiCall(mainLogFile):The sequence of events that causes the issue:
CONFIRM_CALLevent (a priority event).sendLogsOverNetwork()is called immediately (not deferred).sendLogsOverNetwork()firstawaitssendCachedLogsFromIDB(), which reads cached logs from IndexedDB, sends them via beacon, and then clears IDB — all of which is async and slow.beaconApiCall(mainLogFile)execute to send the current log batch (containingCONFIRM_CALL).clientSecret.beaconApiCallever runs.Why Safari is worst affected: Safari's IndexedD is particularly slow. The
awaitonsendCachedLogsFromIDB()takes so long that the context is always destroyed beforebeaconApiCallexecutes. On Chrome/Firefox, IndexedDB is faster, so it sometimes completes in time — but it's still a race condition.Fix
Removed the
awaitonsendCachedLogsFromIDB()so it runs as fire-and-forget.beaconApiCall(mainLogFile)now executes immediately without being blocked by the IDB operation:Since
navigator.sendBeaconis designed for reliable delivery during page unload (fire-and-forget at the browser level), theCONFIRM_CALLlog is now always sent regardless of IDB latency or how quickly the merchant unmounts the SDK. The cached IDB logs are still sent — just concurrently instead of sequentially.How did you test it?
CONFIRM_CALLlog events are now sent reliably on Safari when the SDK is unmounted immediately after payment responseCONFIRM_CALLlog events are sent reliably on Chromeeven with rapid SDK unmount/re-initialize cyclesChecklist
npm run re:build