Repository navigation
Description
Expected Behavior
The SDK's shared operation-error metadata should preserve the checkpointed ErrorType for both instrumentation plugins:
- OpenTelemetry (
@aws/durable-execution-sdk-js-otel): both execution and invocation views should record it asexception.type, as required by G01. - Durable Execution Telemetry (
@aws/durable-execution-sdk-js-telemetry-exporter): operation records should retain it inoperations[].error.nameand, when present,operationsByName.<name>.error.name. Every configured exporter destination receives these records.
A user or external error should not be relabeled as StepError merely because the SDK reconstructs it for instrumentation. The defect is in shared SDK metadata construction, so this issue covers both plugins.
For the reported scenarios, both the execution and invocation views should record:
| Scenario | Span | Expected exception type |
|---|---|---|
S12: child-context function throws new Error(...) directly |
otel-failed-child-context |
Error |
S17: callback is failed externally with ErrorType: "RejectedError" |
otel-failed-callback-callback |
RejectedError |
S18: invoked durable handler throws new Error(...) directly |
otel-failed-invoke |
Error |
The parent otel-failed-callback span should continue to record CallbackExternalError. Caller-facing SDK errors, including CallbackExternalError, ChildContextError, and InvokeError, should retain their existing behavior.
Actual Behavior
The reported X-Ray traces show StepError for all three spans above even though the stored failures contain ErrorType: "Error" or ErrorType: "RejectedError". Custom types that are not defined by the SDK encounter the same fallback.
There is also a delivery-path inconsistency for callbacks: the live completion hook replaces the stored diagnostic error with CallbackExternalError, while stored/replayed metadata is reconstructed as StepError. Neither represents the external RejectedError on the callback leaf.
The OTel plugins pass these errors to span.recordException(...), so their names become exported exception.type values.
The telemetry exporter also consumes the same checkpoint-derived OperationInfo.error. It writes the error's own name and cause without unwrapping them. As a result, an operation whose stored type is RejectedError is exported with error.name: "StepError" and error.cause.name: "RejectedError". The original type is present in the synthetic cause, but the top-level operation error is mislabeled. This affects all telemetry exporter destinations and both operation record formats.
Steps to Reproduce
Run each scenario separately with the execution OTel plugin and the invocation OTel plugin, using an in-memory span exporter or an OTel backend such as X-Ray.
- Call
runInChildContext("otel-failed-child-context", async () => { throw new Error("child failed"); }). Throw directly from the child function, rather than from a step inside it. - Call
waitForCallback("otel-failed-callback", submitter). Fail its callback withErrorType: "RejectedError"and an error message. Exercise both completion while the invocation is active and completion after suspension. - Call
invoke("otel-failed-invoke", qualifiedTarget, input), where the target durable handler directly throwsnew Error("target failed"). - Inspect each operation's stored
ErrorTypeand the corresponding span's exception event. The stored type andexception.typediffer. - Catch the failures and suspend at a later durable operation, then resume. Verify that completed work is skipped and the original diagnostic type is preserved in replay metadata.
The existing OTel conformance scenarios S12, S17, and S18 exercise the reported cases.
For the telemetry plugin, repeat these scenarios with durableExecutionTelemetry and a capturing exporter. Compare the stored ErrorType with operations[].error.name and operationsByName.<name>.error.name where available, including the cause shape on initial execution and replay. This SDK-to-exporter path also needs regression coverage.
SDK Version
Source revision: 6d024cbe7ee6a95e8d814eb8a58d5c5bb41d67ab
@aws/durable-execution-sdk-js:3.0.0@aws/durable-execution-sdk-js-otel:2.0.0@aws/durable-execution-sdk-js-telemetry-exporter:1.0.0
Node.js Version
22.x — local reproduction used Node.js 22.23.4. The runtime version of the originally reported cloud traces is unspecified.
Is this a regression?
Unknown; no last working version has been established.
Additional Context
The error is relabeled during SDK metadata construction:
DurableOperationError.fromErrorObjectfalls back toStepErrorfor unrecognized types, includingErrorandRejectedError.toOperationInfouses that caller-facing reconstruction for plugin metadata.- The child-context failure path explicitly supplies the reconstructed wrapper to the plugin, including virtual contexts.
- The live callback failure path overrides the metadata with the caller-facing callback error.
- The invoke failure path sends
toOperationInfometadata to the plugin and separately constructs the caller'sInvokeError.
The telemetry exporter passes each operation error through toErrorRecord, which preserves the supplied name and cause. This confirms that the defect is visible outside OTel.
A fix should reconstruct diagnostic errors from the stored type, message, stack, and error data, while retaining the current caller-facing reconstruction and errorMapper behavior. Missing error details should remain absent.
Compatibility and validation for both plugins
Changing the shared conversion is an observable metadata change for both plugins. For example, a checkpointed external rejection would change from:
{"name":"StepError","message":"rejected","cause":{"name":"RejectedError","message":"rejected"}}to:
{"name":"RejectedError","message":"rejected"}- Telemetry queries and consumers that filter on
StepErroror read the original type from an operation'serror.cause.namemay need updating. The local candidate removes the synthetic wrapper/cause; it does not rewrite previously exported records. - Custom plugins still receive an
Error, but wrapper-specific assumptions such asinstanceof StepError,.errorType, or a synthetic.causecan change. - Caller-facing exceptions, retry behavior, and
InvocationEndInfo.executionErrorshould remain unchanged. - The telemetry exporter's documentation of operation causes and invoke error names describe the existing wrapper shape and need updating with the fix.
- Regression coverage must exercise the real SDK-to-telemetry-exporter conversion as well as both OTel views. Existing exporter unit tests that inject errors directly do not establish compatibility for this change.
Local regression tests reproduced the bug. A local candidate fix passes 1,586 SDK tests and 38 OTel integration cases covering both views, live/resumed delivery, replay, and custom error names. The candidate is not published. SDK-to-telemetry-exporter regression coverage and the documentation updates above remain outstanding, and cloud conformance traces have not been rerun.
Activity
[-][Bug]: OTel operation spans report StepError instead of the checkpointed exception type[/-][+][Bug]: OTel and telemetry exporter report StepError instead of checkpointed operation error types[/+]hln33 commentedon Oct 30, 2026
Severity - medium
What is wrong.
exception.typeon OTel spans andoperations[].error.namein telemetry exporter records carryStepErrorinstead of the stored type. Any trace filter, alert, or dashboard keyed on exception type reads the wrong value.What is correct. Span status, error message, stack trace, execution outcome, retries, and the exception the caller receives are all unchanged. The telemetry exporter keeps the original type under
error.cause.name.Scope. Every user of
@aws/durable-execution-sdk-js-otelor@aws/durable-execution-sdk-js-telemetry-exporterwhose failing operation has a non-SDK error type. That is the common case for user code.Not a regression. The fallback predates the first release of both plugins. The plugins have always emitted this value.
Why not higher severity There is no ongoing outage, no data loss, and no change to execution behavior. A customer can still identify the failure from the message.
Why not lower severity. The defect affects every plugin user on a standard OTel attribute. The fix changes the exported metadata shape, so each release that ships the current shape raises the cost of changing it later.