Remote: a failing render() in the remote iframe becomes an unhandled rejection on the host

Open
#3,547 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
58/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
react, typescript

Research direction

Start at the end of packages/remote-core/src/connection/connectRemoteIframe.ts, where result.thread.imports.render(connection) is called, and read how onError reaches RemoteRenderer’s error state. Then inspect connectHostRenderRoot.ts and RemoteMutationObserver.observe to understand the reported rejection and reproduce it in Firefox with an affected extension. Done means a failed render reaches onError without causing an unhandled rejection; the issue names no test.

Written by the indexing model from the issue text.

Description

bug

When the remote's render fails, the host gets an unhandled promise rejection instead of the RemoteRenderer error state. The rejection crosses the thread boundary, so it arrives without a stack trace.

Where

packages/remote-core/src/connection/connectRemoteIframe.ts, end of connectRemoteIframe:

result.thread.imports.render(connection);
return result;

The call is neither awaited nor given a catch. On the remote side, render runs connectRemoteReceiver (connectHostRenderRoot.ts), which calls new RemoteMutationObserver(receiverConnection).observe(root). Anything that throws there rejects the host's render promise, and nobody handles it.

Seen in mStudio

mStudio Sentry shows 5 events from 3 users since mid-October, all on pages that embed an extension frontend, all in Firefox 157/158 (Linux and Windows):

TypeError: MutationObserver.observe: One of 'childList', 'attributes', 'characterData' must not be false.
mechanism: onunhandledrejection, no stack frames

RemoteMutationObserver.observe defaults childList, attributes and characterData to true, so why Firefox throws inside the iframe is still unclear. It could be a different remote-dom-core version bundled by the extension, or something Firefox-specific. That part needs a reproduction in Firefox with an affected extension.

Expected

A failing render is reported through onError, so RemoteRenderer shows its error state and the host app does not get an unhandled rejection.

Dominant language
TypeScript
Stars
15
Forks
4
Avg merge
2d 2h
Merged PRs (30d)
128

Getting set up

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.

More from mittwald/flow

All issues in mittwald/flow

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.