cli icon indicating copy to clipboard operation
cli copied to clipboard

netlify open:site hangs with Brave browser

Open whitep4nth3r opened this issue 2 years ago • 3 comments

Describe the bug

netlify open:site hangs or fails silently with Brave browser set as default.

The following command ran successfully and opened Firefox as expected:

BROWSER=firefox ntl open:site

To Reproduce

Steps to reproduce the behavior on Mac OS:

  1. Use latest CLI version
  2. Set Brave to default system browser
  3. Run netlify open:site
  4. Notice that Brave browser has not opened after a considerable amount of time

I've noticed that sometimes the command completes after some minutes, but generally fails silently forever.

Configuration

No netlify.toml was used for this site.

  System:
    OS: macOS 12.2
    CPU: (10) arm64 Apple M1 Pro
    Memory: 1.51 GB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 17.3.0 - /opt/homebrew/bin/node
    Yarn: 1.22.17 - /opt/homebrew/bin/yarn
    npm: 8.3.0 - /opt/homebrew/bin/npm
  npmGlobalPackages:
    netlify-cli: 8.14.1

Expected behavior

Brave browser opens in a timely manner when running netlify site:open.

CLI Output

Terminal hangs in this state:

A screenshot of the terminal showing that the CLI is attempting to open a site

whitep4nth3r avatar Jan 31 '22 13:01 whitep4nth3r

The log line is here https://github.com/netlify/cli/blob/f1c4d1017acba380048c06efa98b51b967f763d2/src/commands/open/open-site.js#L27

which means it probably hangs on https://github.com/netlify/cli/blob/f1c4d1017acba380048c06efa98b51b967f763d2/src/utils/open-browser.js#L36.

And to add more context @whitep4nth3r, ntl dev doesn't experience the same behavior, correct?

erezrokah avatar Jan 31 '22 14:01 erezrokah

ntl dev experiences the same behaviour. Whilst the development server has started and I can navigate to a working development site in a browser manually, ntl dev does NOT open a browser tab.

whitep4nth3r avatar Jan 31 '22 14:01 whitep4nth3r

Interestingly, when I kill the ntl dev process, that's when the browser tab opens.

whitep4nth3r avatar Jan 31 '22 14:01 whitep4nth3r

@whitep4nth3r Are you still experiencing this issue?

I installed Brave & set it as my default browser. Then tried the open:site command. Version: netlify-cli/10.15.0

Brave Browser opens the the url as expected.

If you're still experiencing the issue:

Can you check which browsers are running on your system when you're using the open:site command?

The external dependency (better-opn) which is currently being used to open the browser disregards the default browser preference on MacOS in some specific cases.

tinfoil-knight avatar Aug 11 '22 12:08 tinfoil-knight

Not experiencing this issue anymore. Thanks for following up!

whitep4nth3r avatar Aug 11 '22 13:08 whitep4nth3r