IPC handlers registered before devtron.install() receive wrapped payloads instead of original arguments
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- electron, typescript
Research direction
Start by tracing patchIpcMain(), the ipcMain.handle registration path, and the renderer-preload ipcRenderer.invoke wrapping described in the issue. Compare handlers registered before and after devtron.install() and determine which proposed approach fits the existing IPC flow. Done means pre-existing handlers receive original arguments without breaking wrapped devtron calls, with the reproduction scenario verified.
Written by the indexing model from the issue text.
Description
Describe the bug
When devtron.install() is called after other libraries have already registered IPC handlers via ipcMain.handle(), those pre-existing handlers receive devtron's wrapped payload object { __uuid__devtron, args } instead of the original arguments.
This is because:
- Devtron's
patchIpcMain()replacesipcMain.handlewith a wrapper that callsgetArgsFromPayload()to unwrap arguments - However, handlers registered before
patchIpcMain()was called are using the originalipcMain.handle, so they never go through the unwrapping logic - Meanwhile, devtron's renderer-preload always wraps
ipcRenderer.invokecalls with the{ __uuid__devtron, args }payload format
To Reproduce
- Register an IPC handler before devtron is installed:
// Early in app initialization
ipcMain.handle('my-channel', (event, methodName, ...args) => {
console.log('methodName:', methodName); // Expects a string like 'doSomething'
});
2. Install devtron later (e.g., after app.whenReady()):
app.whenReady().then(async () => {
const { devtron } = await import('@electron/devtron');
await devtron.install();
});
3. From the renderer, invoke the channel:
ipcRenderer.invoke('my-channel', 'doSomething', { data: 'test' });
4. Expected: methodName is 'doSomething'
5. Actual: methodName is { __uuid__devtron: '...', args: ['doSomething', { data: 'test' }] }
Real-world example
This breaks @bugsnag/electron which registers IPC handlers during module initialization (before devtron can be installed). When calling bugsnag.notify() from the renderer, the main process logs:
[BUGSNAG] attempted to call IPC method named "[object Object]" which doesn't exist
And Bugsnag is initialized before everything else in an Electron app, to catch as many as possible bugs.
Suggested solutions
- Patch existing handlers - When patchIpcMain() is called, retroactively wrap any handlers that were already registered with the unwrapping logic.
OR
- Channel exclusion list - Allow users to specify channels that should be excluded from devtron's payload wrapping:
devtron.install({
excludeChannels: ['bugsnag::renderer-to-main', 'bugsnag::renderer-to-main-sync']
});
- Dominant language
- TypeScript
- Stars
- 1.8k
- Forks
- 110
- Avg merge
- 2h 28m
- Merged PRs (30d)
- 5
Getting set up
We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from electron/devtron
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
GSoC 2025
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 30/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
All issues in electron/devtron
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
diegosouzapw/OmniRoute#14869 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 94/100
Maintainers usually reply within 1 day
-
status: waiting triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
freeCodeCamp/freeCodeCamp#70412 ·
Maintainers usually reply within 1 day
-
Mend: dependency security vulnerability untriaged
Difficulty 1/5 Under an hour Newbie friendliness 88/100
opensearch-project/OpenSearch-Dashboards#12816 ·
Maintainers usually reply within 1 day