Repository navigation
fix(rivetkit): keep UserErrors intact when their metadata is not JSON - #5782
Conversation
|
Stack for rivet-dev/actors
Get stack: change skulmuyw |
|
This PR was not deployed automatically as @eersnington does not have access to the Railway project. In order to get automatic PR deploys, please add @eersnington to your workspace on Railway. |
|
Review: fix(rivetkit): leave error metadata out of span error encoding Summary Correct, well-scoped fix. Root cause is exactly what the PR description says: I traced both call sites ( Also worth noting: the real error thrown to the caller ( Test coverage gap The new/renamed test ( Since Minor
Verdict Looks correct and safe to merge. The one actionable suggestion is adding a direct unit test (or a driver test through the 🤖 Generated with Claude Code |
2becb24 to
33c84b3
Compare
33c84b3 to
575812e
Compare
A
UserErrorwhose metadata JSON cannot encode, such as abigint, was replaced by aTypeErrorwhen it crossed from TypeScript into core.runinternal_errorcard_declined, without metadatac.client()call, tracing onTypeErrorencodeBridgeRivetErrorencodes every structured error that crosses into core. WhenJSON.stringifythrows, it encodes the error again without metadata and returns the cause asdroppedMetadataCause.encodeNativeCallbackErrorlogs a warning with the group, code, and cause when metadata was dropped. The span paths ignore it, because spans never read metadata.actor/errors.tshas no runtime imports, sorivetkit/errorsbundles to 4.7 KB minified. Importing the logger there would pull inpinoandzodand grow it to 304 KB.UserErroris returned to the client and only other errors becomeinternal_error. This keeps that true for metadata JSON cannot encode.This is part 1 of 3 in a stack: