shell.openExternal is not opening valid URLs

Viewed 949

I recently updated an Electron Mac app from Electron v5.0.1 to v9.0.1 and it seems that shell.openExternal(url) is no longer working. Nothing will open and an error will be logged to the console:

Uncaught (in promise) Error: Failed to open URL

This is on macOS 10.15.4 (Catalina). I couldn't find any useful information about this error online. Anyone have any ideas?

1 Answers

I was having this problem and solved it by getting shell with:

const { shell } = require('electron').remote

instead of just

const { shell } = require('electron')

Also on a Mac (macOS 11.1), although I'm not sure if that's particularly relevant since this is an issue of calling from a renderer process.

Related