restatedev / restatedev/sdk-typescript

RestatePromise.any with all-rejected promises throws AggregateError instead of TerminalError

Open
#672 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
122
Forks
27
Avg merge
9h 17m
Merged PRs (30d)
8

Description

Problem

When all promises passed to RestatePromise.any() are rejected (e.g. via RestatePromise.reject()), the resulting AggregateError thrown by Promise.any() is not a TerminalError. This causes Restate to retry the invocation indefinitely instead of failing terminally.

Expected behavior

The AggregateError should either:

  1. Be automatically wrapped in a TerminalError by the SDK (since all inner errors are TerminalErrors), or
  2. Be documented as a known behavior with guidance on how to handle it

Reproduction

const promises = ["err1", "err2"].map((m) =>
  RestatePromise.reject<string>(new restate.TerminalError(m))
);
// This throws AggregateError (not TerminalError), causing infinite retries
return RestatePromise.any(promises);

Context

Found while adding e2e tests for RestatePromise.resolve/RestatePromise.reject (PR #611).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the implementation of RestatePromise.any and the e2e tests referenced from PR #611. Reproduce the all-rejected case with RestatePromise.reject and trace how AggregateError reaches invocation handling. Done means either terminal failure is preserved when all inner errors are TerminalError instances, or the behavior is documented with handling guidance.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.