matrix-org / matrix-org/matrix-hookshot

waitForComplete + transformation function returns HTTP error

Open
#1,251 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
450
Forks
95
Avg merge
1d 2h
Merged PRs (30d)
23

Description

Generic webhooks return `{"ok":false,"error":"Failed to process webhook"}` when both `waitForComplete` and a transformation function are enabled. The message posts to the room fine, but the HTTP caller gets an error.

Each works independently — only the combination breaks.

**Cause:** When the transformation's `execute()` throws, `onGenericHook` sets `successful = false` but still delivers a fallback message. Without `waitForComplete` the caller gets HTTP 202 (`successful: null` path). With `waitForComplete`, the `false` reaches the Router and returns HTTP 500. This also makes `webhookResponse` (#839) unusable since it requires `waitForComplete`.

A secondary issue: if `onGenericHook` throws with `waitForComplete` on, Bridge.ts never queues a response — the caller gets a generic error with no details.

**Fix branch:** https://github.com/yncyrydybyl/matrix-hookshot/tree/yncyrydybyl/fix-waitforcomplete-transformation

Related: #247, #839

Contributor guide

Open the contributing guide

Research direction

Start by reading onGenericHook and Bridge.ts, then trace how the Router handles transformation failures when waitForComplete is enabled. Done means the combined webhook path no longer returns an HTTP error while still delivering the fallback message, and thrown hooks provide a queued response with details.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.