GoogleChromeLabs / GoogleChromeLabs/comlink

Full stack traces

Open
#545 0 comments 5 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
12.8k
Forks
435
PR merge metrics
No merged PRs in 30d

Description

As-is, the thread boundary is very problematic for debugging client-side JavaScript.

If, for example, we have a function `balls` that calls into a thread via comlink, from what I can tell the stack data is basically lost every time we run `balls()`. If an error occurs within the thread, it'll print a stack trace with nothing of value until after the `self.onmessage` line, i.e. it drops the entire calling context of `balls()` and shows only what's inside the thread. If an error occurs at some point after `await balls();`, it'll likewise make it look as though `window.onmessage` had fired out of the blue with the same information missing.

I'm surprised that this hasn't been brought up much (if at all) before, considering what a major problem it is, at least for us. We've thought about trying to improve this on our end with some logging or ideally even altering the stack trace, but aren't sure what the best approach would be and would rather have every Comlink user benefit than deal with building a one-off bespoke solution.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.