Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Mac AppStore app BrowserWindow loadURL ERR_FAILED (-2) #35866

Closed
3 tasks done
stefanJi opened this issue Sep 30, 2022 · 3 comments
Closed
3 tasks done

[Bug]: Mac AppStore app BrowserWindow loadURL ERR_FAILED (-2) #35866

stefanJi opened this issue Sep 30, 2022 · 3 comments

Comments

@stefanJi
Copy link

stefanJi commented Sep 30, 2022

Preflight Checklist

Electron Version

15.3.3

What operating system are you using?

macOS

Operating System Version

macOS 12.3.1

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

Window loadURL can work

Actual Behavior

Make macOS app with the electron-builder, dmg can running work as excepected, but mas cann't.

const defaultWebPreferences: WebPreferences = {
    preload: getPreload(),
    nodeIntegration: true,
    contextIsolation: false,
    devTools: true,
    webSecurity: false,
    sandbox: false
}

window.loadURL(url.format({ pathname: path.join(__dirname, 'renderer', name, 'index.html'), protocol: 'file:', slashes: true }))

mas pkg installed by TestFlight in mac:

loadURL Error: ERR_FAILED (-2) loading 'file:///Applications/xx.app/Contents/Resources/app.asar/renderer/login/index.html'
    at rejectAndCleanup (node:electron/js2c/browser_init:201:7486)
    at Object.stopLoadingListener (node:electron/js2c/browser_init:201:7861)
    at Object.emit (node:events:406:35) {
  errno: -2,
  code: 'ERR_FAILED',
  url: 'file:///Applications/xx.app/Contents/Resources/app.asar/renderer/login/index.html'
}

renderer/login/index.html is exsited in app.asar.

Testcase Gist URL

No response

Additional Information

No response

@VerteDinde
Copy link
Member

Thanks for reporting this issue! Would it be possible for you to make a standalone testcase with only the code necessary to reproduce the issue? For example, Electron Fiddle is a great tool for making small test cases and makes it easy to publish your test case to a gist that Electron maintainers can use.

Stand-alone test cases make fixing issues go more smoothly: it ensure everyone's looking at the same issue, it removes all unnecessary variables from the equation, and it can also provide the basis for automated regression tests.

I'm adding the blocked/need-repro label for this reason. After you make a test case, please link to it in a followup comment.

Thanks in advance!

@VerteDinde VerteDinde added platform/macOS blocked/need-repro Needs a test case to reproduce the bug 15-x-y labels Oct 2, 2022
@stefanJi
Copy link
Author

I found remove hardenedRuntime will work.

@wtl1019
Copy link

wtl1019 commented Nov 30, 2023

I found remove hardenedRuntime will work.

please show what did you set 'hardenedRuntime'?

@electron-issue-triage electron-issue-triage bot removed the blocked/need-repro Needs a test case to reproduce the bug label Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants