Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

LSOpenURLsWithRole() failed with error -10810 on the packaged build #5849

Closed
luixxiul opened this issue Nov 26, 2016 · 12 comments
Closed

LSOpenURLsWithRole() failed with error -10810 on the packaged build #5849

luixxiul opened this issue Nov 26, 2016 · 12 comments

Comments

@luixxiul
Copy link
Contributor

luixxiul commented Nov 26, 2016

From Terminal when I try to open the packaged build, I get this.

Brave-MacBook-Pro:browser-laptop Suguru$ open ./Brave-darwin-x64/Brave.app
LSOpenURLsWithRole() failed with error -10810 for the file /Users/Suguru/browser-laptop/Brave-darwin-x64/Brave.app.

CC @dcposch

@dcposch
Copy link
Contributor

dcposch commented Nov 26, 2016

What does LSOpenURLsWithRole do? How does it related to #5818 ?

@luixxiul
Copy link
Contributor Author

luixxiul commented Nov 26, 2016

I haven't see the error until I packaged the build after commits related with the webtorrent were merged but I am not sure if it has nothing to do with them, which is why I tagged #5818 as the related issue.

@luixxiul
Copy link
Contributor Author

Just now I confirmed that packaged build based on 8b6dada ran, which is right before the first commit on Webtorrent eb004bd was merged. /cc: @feross

@luixxiul
Copy link
Contributor Author

Also I found that the packaged build based on d14c778 ran. 4619405 "move webtorrent to the browser process" seems to break the build.

@dcposch
Copy link
Contributor

dcposch commented Nov 27, 2016

Thanks for bisecting. I'll experiment with it today and see if I can find out why.

@dcposch
Copy link
Contributor

dcposch commented Nov 29, 2016

Still don't know why.

CHANNEL=dev npm run build-packgage
cd Brave-darwin-x64
open Brave.app

Works with d14c778

Fails on commits after that. Error message:

LSOpenURLsWithRole() failed with error -10810 for the file /Users/dc/code/browser-laptop/Brave-darwin-x64/Brave.app.

I diffed the Brave.app folders from before and after, but I don't see anything obvious.

@dcposch
Copy link
Contributor

dcposch commented Nov 29, 2016

it works if is remove a few lines from browser/webtorrent.js so that it no longer loads WebTorrentRemoteServer, while leaving everything else the same.

when I lazy load WebTorrentRemoteServer instead of require()ing it right away, Brave runs, but crashes as soon as I load the first torrent (in other words, it crashes as soon as WebTorrentRemoteServer, and by extension require('webtorrent'), is called)

  • i could definitely use help from someone who understands Brave's build system better than I do. webtorrent works when running with npm start, but fails in the packaged app.

  • where does the packaged app write its logs?

@dcposch
Copy link
Contributor

dcposch commented Nov 29, 2016

found the crash

instead of running open Brave.app, go to Brave-darwin-x64/Brave.app/Contents/MacOS and then run ./Brave. that way, you get console output from the browser process.

here's the crash when trying to require('webtorrent') in the packaged app:

Crash reporting enabled
An uncaught exception occurred in the main process Uncaught Exception:
Error: Cannot find module 'speedometer'
    at Module._resolveFilename (module.js:455:15)
    at Function.Module._resolveFilename (/Users/dc/code/browser-laptop/Brave-darwin-x64/Brave.app/Contents/Resources/electron.asar/common/reset-search-paths.js:35:12)
    at Function.Module._load (module.js:403:25)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/dc/code/browser-laptop/Brave-darwin-x64/Brave.app/Contents/Resources/app.asar/node_modules/webtorrent-remote/node_modules/webtorrent/index.js:19:19)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
/Users/dc/code/browser-laptop/Brave-darwin-x64/Brave.app/Contents/Resources/app.asar/node_modules/node-anonize2-relic-emscripten/anonize2.js:18
if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;if(Module["ENVIRONMENT"]){if(Module["ENVIRONMENT"]==="WEB"){ENVIRONMENT_IS_WEB=true}else if(Module["ENVIRONMENT"]==="WORKER"){ENVIRONMENT_IS_WORKER=true}else if(Module["ENVIRONMENT"]==="NODE"){ENVIRONMENT_IS_NODE=true}else if(Module["ENVIRONMENT"]==="SHELL"){ENVIRONMENT_IS_SHELL=true}else{throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.")}}else{ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="func

Error: Cannot find module 'speedometer'
    at Module._resolveFilename (module.js:455:15)
    at Function.Module._resolveFilename (/Users/dc/code/browser-laptop/Brave-darwin-x64/Brave.app/Contents/Resources/electron.asar/common/reset-search-paths.js:35:12)
    at Function.Module._load (module.js:403:25)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/dc/code/browser-laptop/Brave-darwin-x64/Brave.app/Contents/Resources/app.asar/node_modules/webtorrent-remote/node_modules/webtorrent/index.js:19:19)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)

@feross @bbondy @diracdeltas @luixxiul

@dcposch
Copy link
Contributor

dcposch commented Nov 29, 2016

manual fix

manually adding speedometer to app.asar/node_modules fixes it.

first navigate to Brave-darwin-x64/Brave.app/Contents, then:

npm install asar -g
asar e Resources/app.asar derp
cp -r cp -r ../../../node_modules/webtorrent-remote/node_modules/speedometer derp/node_modules/
asar pack derp Resources/app.asar
./MacOS/Brave

so we have to fix the packaging script that creates app.asar. my guess is that it's not including transitive dependencies correctly

@dcposch
Copy link
Contributor

dcposch commented Nov 29, 2016

real fix

derp

PR coming soon

@luixxiul
Copy link
Contributor Author

I labelled this with QA/no qa needed as this fixed the issue for a packaged build

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants