Do not let a failed send break the page - #48
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## fix/26-http-client-wiring #48 +/- ##
===============================================================
+ Coverage 77.00% 77.35% +0.34%
- Complexity 139 140 +1
===============================================================
Files 30 30
Lines 461 468 +7
===============================================================
+ Hits 355 362 +7
Misses 106 106 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
loevgaard
force-pushed
the
fix/26-http-client-wiring
branch
from
September 7, 2026 12:03
155836b to
7d0d09e
Compare
loevgaard
force-pushed
the
fix/16-sync-failures
branch
from
September 7, 2026 12:03
7107a61 to
b06fbd4
Compare
loevgaard
force-pushed
the
fix/26-http-client-wiring
branch
from
September 7, 2026 12:18
7d0d09e to
88c612e
Compare
loevgaard
force-pushed
the
fix/16-sync-failures
branch
from
September 7, 2026 12:18
b06fbd4 to
db88227
Compare
loevgaard
force-pushed
the
fix/26-http-client-wiring
branch
from
September 7, 2026 12:46
88c612e to
632c3c2
Compare
loevgaard
force-pushed
the
fix/16-sync-failures
branch
from
September 7, 2026 12:46
db88227 to
bb2ba25
Compare
With synchronous handling the http call to Meta happens inside the visitor's request, and the SDK throws for any non-200 response, so an expired access token returned a 500 for every page raising an event. Catch and log at error level when dispatching. Routed setups are unaffected, since the handler then runs in the worker. Fixes #16
loevgaard
force-pushed
the
fix/26-http-client-wiring
branch
from
September 7, 2026 12:51
632c3c2 to
2a07fca
Compare
loevgaard
force-pushed
the
fix/16-sync-failures
branch
from
September 7, 2026 12:51
bb2ba25 to
865684c
Compare
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.
Fixes #16
Problem
DispatchOnCommandBusSubscriberdispatches atPRIORITY_SEND, inside the visitor's request. Unless the application routesSendEventto a transport, Messenger handles it synchronously and the SDK posts tograph.facebook.comright there.Client::sendEvent()throwsClientExceptionfor any non-200 response, Messenger wraps it inHandlerFailedException, and it propagates out ofEventDispatcher::dispatch()into the controller that raised the event.One expired access token therefore returned a 500 for every page that raises an event: product pages, checkout confirmation, registration.
Change
Dispatching is wrapped in a
try/catchthat logs at error level with the event name, event id and the exception. Only two things can reach it:Neither is reachable once the command is routed to a working transport, because
dispatch()then only hands the message to the transport and the handler runs in the worker. Messenger's retry and failure handling is untouched for routed setups.The README now presents async routing as the expected setup with the reason spelled out, rather than as an aside after the configuration reference.
Tests
Three unit tests: the command is dispatched with the right event, nothing is dispatched without consent, and a bus that throws results in one error log record and no exception escaping.