Issues with receiving data from callMain
See original GitHub issueHello, I’ve run into this issue over the past week that I’ve been unable to move beyond, and I would appreciate another pair of eyes.
In my renderer, I have 2 separate pieces of code that use callMain to get a response back from the main process. One of them returns data just fine, the other returns nothing at all, despite logging showing that the main listener receives it and returns successfully. I even used devtron to see that a message is getting sent to the renderer, but for some reason the listener is not working as expected.
I wonder if I am just fundamentally misinterpreting the library, or if there is something causing my second call to fail. Any thoughts would be appreciated. Main and rendering code is shown below:
renderer.js
// this function works fine
function* checkExistingUser() {
console.log('checking existing user.');
const resp = yield ipc.callMain('check-existing-user', 'TESTUSER');
if (resp.error) {
console.error('Received error from ipc main');
return;
}
// other behavior
}
// this function doesn't return data from callMain
function* unlockUserCredentials(action) {
let localUserData = yield select(getLocalData);
// code makes it here, logging shows up
try {
const resp = yield ipc.callMain('unlock-user-credentials', credData);
console.log(resp); // never shows up in logs
} catch (error) {
console.log(error); // never shows up in logs
}
}
My main file:
// this function responds fine, and data is accessible on the client
ipc.answerRenderer('check-existing-user', async data => {
// working returns
return {};
});
// this function returns successfully, even with try catch
ipc.answerRenderer('unlock-user-credentials', async data => {
return {
message: 'sample data',
};
});
am I doing something wrong by having multiple ipc answer renderers here? Any thoughts or ideas are appreciated. As a note, my renderer code is written for use with redux-saga.
IssueHunt Summary
garrylachman has been rewarded.
Backers (Total: $60.00)
issuehunt ($60.00)
Submitted pull Requests
Tips
- Checkout the Issuehunt explorer to discover more funded issues.
- Need some help from other developers? Add your repositories on IssueHunt to raise funds.
IssueHunt has been backed by the following sponsors. Become a sponsor
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (1 by maintainers)

Top Related StackOverflow Question
I fix the issue in my fork. https://github.com/garrylachman/electron-better-ipc
@sindresorhus has rewarded $54.00 to @garrylachman. See it on IssueHunt