question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DeprecationWarning with Electron 8.0.0

See original GitHub issue

Hi,

a deprecation warning is being shown when electron-log is used with Electron 8.0.0 and webPreferences: { nodeIntegration: true } is set.

(node:69267) DeprecationWarning: Passing functions, DOM objects and other non-cloneable JavaScript objects to IPC methods is deprecated and will throw an exception beginning with Electron 9.

The problem seems to be these 2 lines https://github.com/megahertz/electron-log/blob/master/src/transports/ipc.js#L28 https://github.com/megahertz/electron-log/blob/master/src/electronApi.js#L123 related to this change https://github.com/electron/electron/pull/20214

Steps to reproduce

node@12.14.1
electron@8.0.0
electron-log@4.0.5
$ npx electron ./tests/test.js
08:40:02.497 › App ready!
(node:69513) DeprecationWarning: Passing functions, DOM objects and other non-cloneable JavaScript objects to IPC methods is deprecated and will throw an exception beginning with Electron 9.
(node:69513) DeprecationWarning: Passing functions, DOM objects and other non-cloneable JavaScript objects to IPC methods is deprecated and will throw an exception beginning with Electron 9.

test.js

const path = require('path')
const electron = require('electron')
const { app, BrowserWindow } = electron
const logger = require('electron-log')

app.allowRendererProcessReuse = true

app.once('ready', () => {
  logger.info('App ready!')

  const win = new BrowserWindow({
    webPreferences: {
      nodeIntegration: true
    }
  })

  win.loadURL(`file://${path.resolve(__dirname, 'index.html')}`)
})

index.html

<!DOCTYPE html>
<head>
  <meta charset="utf-8">
  <title>Test</title>
</head>
<body>
  <h1>Hello</h1>
</body>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
megahertzcommented, Mar 25, 2020

Thank you for the example @raphinesse, I’ll try to fix that on this week.

0reactions
raphinessecommented, Mar 29, 2020

Thanks for your quick fix. Works great for me! 🏅

Read more comments on GitHub >

github_iconTop Results From Across the Web

Electron 8.0.0
Electron 8.0.0 has been released! It includes upgrades to Chromium 80 ... Show module name in deprecation warning for context-aware modules.
Read more >
Warning message "DeprecationWarning: Invalid 'main' field in ...
This warning message will only show on Node 16. You can safely ignore the warning, but to get rid of it you can...
Read more >
Deprecated APIs | Node.js v19.3.0 Documentation
Deprecated APIs#. Node.js APIs might be deprecated for any of the following reasons: Use of the API is unsafe. An improved alternative API...
Read more >
electron-mocha/CHANGELOG.md - UNPKG
The CDN for electron-mocha. ... 93, 8.0.0 / 2019-04-08. 94, ------------------ ... "Squash deprecation warning for electron 0.35.0".
Read more >
Changelog - Cypress Documentation
Fixed a regression introduced in the Electron browser in Cypress 10.8.0 where the ... Fixed a regression in 8.0.0 where Cypress would always...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found