Conversation
Update the sdk-core submodule and adapt the TypeScript SDK to breaking
changes in the core API: replace RetryClient with Connection, update
error types (ClientInitError → ClientConnectError), wrap search
attributes in { indexedFields: ... }, and update codec runner and tests.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Chris Olszewski <chris.olszewski@temporal.io>
…ment. Point to nexus-rpc dependency in git
…old/new server differences
…fallback when a HandlerError has an original Failure that does not have the temporal failure metadata
Evanthx
left a comment
There was a problem hiding this comment.
Not approving or disapproving as I still don't trust my knowledge of the product enough to be an approver, so just making a few comments!
|
|
||
| private nexusFailureToTemporalFailure(failure: nexus.Failure, retryable: boolean): ProtoFailure { | ||
| if (failure.metadata?.type === 'temporal.api.failure.v1.Failure') { | ||
| return failure.details as ProtoFailure; |
There was a problem hiding this comment.
Should you add a check to see if details is undefined? Not sure how that would surface back up or if it's needed, but thought it worth asking
| ): Promise<ProtoFailure> { | ||
| let newError: Error; | ||
| if (err.state === 'canceled') { | ||
| newError = new CancelledFailure(err.message, undefined, err.cause); |
There was a problem hiding this comment.
Not an issue you introduced but I was reading some code when looking at this and CancelledFailure is defined twice in packages/client/src - once in index.ts and a second time in workflow-client.ts. So that feels like an issue waiting to happen!
| case status.INVALID_ARGUMENT: | ||
| return new nexus.HandlerError('BAD_REQUEST', undefined, { cause: err }); | ||
| case (status.ALREADY_EXISTS, status.FAILED_PRECONDITION, status.OUT_OF_RANGE): | ||
| case status.ALREADY_EXISTS: |
There was a problem hiding this comment.
I find logic like this (and the lines following) is usually better in the relevant class - ie, nexus.HandlerError in this case - if possible. What happens over time is that you make a change to HandlerError to add some cases, but there is no good way to track down every place using HandlerError, so not every place gets updated. But if you are in HandlerError making changes, you'll see the method right there and make the relevant changes.
There was a problem hiding this comment.
This logic is Temporal specific, not relevant to HandlerError which is a generic Nexus error. That being said if we do one day inline the Nexus SDK into temporal then it would be a good idea to move it closer, but we haven't committed to that yet
What was changed
Why?
Nexus error serialization now uses Temporal ProtoFailure end-to-end, letting the TypeScript SDK pass failures directly rather than converting to/from Nexus-specific proto types. Core handles backward compatibility for Nexus completions with older servers. This also fixes a JS bug where case (a, b, c): in switch statements silently evaluated only c via the comma operator, causing incorrect gRPC status code mapping.
Checklist
How was this tested: