Kong / Kong/insomnia

Plugin remote access from electron renderer to main process

Open
#4,664 10 comments 3 reactions 0 assignees View on GitHub
A-plugin-api B-bug D-electron N-discussion N-investigation S-verified
Dominant language
TypeScript
Stars
40k
Forks
2.4k
Avg merge
2d 13h
Merged PRs (30d)
61

Description

### Expected Behavior

Access to the Electron remote module api from a plugin running in a renderer Electron process.

### Actual Behavior

Remote module times out when trying to connect to the main process.

### Reproduction Steps

1. Create a plugin making use of the new Electron remote module api: https://github.com/electron/remote
2. Try making use of the api (eg. opening a browser window)
3. Observe error as the module is unable to communicate with the main process

### Is there an existing issue for this?

- [X] I have searched the [issue tracker](https://www.github.com/Kong/insomnia/issues) for this problem.

### Additional Information

As part of the Insomnia Electron upgrade to 17 #4529 , the Electron remote module was removed in favor of the new @electron/remote module: https://www.electronjs.org/docs/latest/breaking-changes#removed-remote-module

Switching to the new module requires explicitly initializing the module in the main process so renderer processes are able to make use of it. Additionally, it must be enabled for each WebContents object. For more information, read https://github.com/electron/remote From what I can tell, Insomnia currently does not do this which limits the capabilities of plugins looking to integrate with Electron apis.

A plugin I had written made use of the remote api to open browser windows with electron-specific event hooks (more than what could be done with the Insomnia plugin dialog api) and this seems to no longer be an option.

### Insomnia Version

2022.2.1

### What operating system are you using?

Windows

### Operating System Version

Windows 10 Home 21H2

### Installation method

download from insomnia.rest

### Last Known Working Insomnia version

2022.1.1

Contributor guide

Open the contributing guide

Research direction

Read the @electron/remote documentation linked in the issue, then inspect Insomnia's Electron main-process setup and plugin renderer WebContents handling. Reproduce the plugin remote API timeout from the listed steps and verify that the remote module can communicate with the main process without timing out.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, typescript
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.