fix: include workspace id in processTransactionTrace query to prevent global update error#710
Merged
Conversation
… global update error The workspace.update() calls were failing because the Sequelize include query was missing the 'id' attribute, causing the workspace instance to have no primary key. This resulted in Sequelize throwing the error: "You attempted to save an instance with no primary key, this is not allowed since it would result in a global update". Adding the 'id' to the attributes list ensures the workspace instance has its primary key set, allowing proper targeted updates. Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
Greptile SummaryThis PR is a targeted one-line bug fix that adds Key changes:
Notes:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Job as processTransactionTrace
participant DB as Transaction (DB)
participant WS as Workspace (DB)
participant T as Tracer (RPC)
Job->>DB: findByPk(transactionId)<br/>include workspace { id, public, rpcServer, ... }
DB-->>Job: transaction + workspace instance (with id ✓)
alt Missing transaction
Job-->>Job: return 'Cannot find transaction'
else Not public
Job-->>Job: return 'Not allowed on private workspaces'
else No explorer / sync disabled / RPC unreachable
Job-->>Job: return early guard
else No subscription / tracing disabled
Job-->>Job: return early guard
end
Job->>T: new Tracer(rpcServer, db, tracing)
Job->>T: tracer.process(transaction)
T-->>Job: parsedTrace or error
alt tracer.error (RPC does not support debug_traceTransaction)
Job->>WS: workspace.update({ tracing: null })
Note right of WS: Requires workspace.id (this fix)
else parsedTrace available
Job->>DB: transaction.safeCreateTransactionTrace(parsedTrace)
DB-->>Job: trace result
alt trace error / not enabled error
Job->>WS: workspace.update({ tracing: null })
Note right of WS: Requires workspace.id (this fix)
end
end
Last reviewed commit: bb36dea |
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.
Summary
Fixes #708
Sentry Error: You attempted to save an instance with no primary key, this is not allowed since it would result in a global update
Root Cause: The Sequelize include query for the workspace object was missing the 'id' attribute, causing the workspace instance to have no primary key set.
Fix: Added 'id' to the workspace attributes list in the include query, ensuring the workspace instance has its primary key for proper targeted updates.
Regression: Not a regression - this appears to be a new error triggered when RPC endpoints return errors that make the code think they don't support debug_traceTransaction.
Test plan
🤖 Generated with Claude Code