forcedotcom / cli

Salesforce CLI
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/
BSD 3-Clause "New" or "Revised" License
493 stars 78 forks source link

`sf org open` broken when browser target is Firefox #2653

Closed pchittum closed 9 months ago

pchittum commented 9 months ago

Note Before you submit your issue, make sure that:

  • You're using the latest version of Salesforce CLI.
  • You've searched both open and closed issues for related posts.
  • You've used the doctor command to diagnose common issues.
  • You understand that GitHub Issues don't adhere to any agreement or SLA.
    • If you require immediate assistance, use official channels such as Salesforce Customer Support.

Summary

When using the command sf org open and the browser is set to --browser firefox Firefox opens a new blank window and does not navigate to the org.

Steps To Reproduce

In my case, I'm using the current main branch of the github.com/trailheadapps/apex-recipes repo.

I have a default DE org logged in (refresh token is current) and configured for the project.

It's been a few months since I used this repo, so I'd just gone and refreshed main branch with git pull origin main and pushed to the org with sf project deploy start which completed with a SUCCESS response.

I then attempted to run sf org open. The command line responded with the message Waiting to resolve the Lightning Experience-enabled custom domain...... done and the window focus changed to Firefox. At that point a new blank/default firefox window was spawned.

I also attempted to run with the flag --path lightning. This produced the same result.

But when attempting to run the command specifying Chrome as the browser (--browser chrome) the behavior is as expected.

I also ran the command with the --url-only and --url-only --path lightning. In each case, the URL was generated which I was able to copy/paste into firefox and I was successfully logged into the org in the browser.

Expected result

Firefox should have opened a new tab and logged into the org.

Actual result

Firefox opens a new default window and doesn't do anything else.

System Information

zsh using oh-my-zsh

Additional information

I have a video, but I'm mindful that the auth token is visible for a moment in the browser address bar, so I'll share it with @mshanemc on the GDS slack channel so he can share it internally.

version information

MacOS: Sonoma 14.1.2 Firefox: Current 121.0.1 zsh: 5.9 OhMyZsh: up to date 486e56a sf: @salesforce/cli/2.24.4 darwin-arm64 node-v20.10.0

result of sf plugins --core: @oclif/plugin-autocomplete 3.0.5 (core) @oclif/plugin-commands 3.1.0 (core) @oclif/plugin-help 6.0.10 (core) @oclif/plugin-not-found 3.0.8 (core) @oclif/plugin-plugins 4.1.15 (core) @oclif/plugin-search 1.0.11 (core) @oclif/plugin-update 4.1.7 (core) @oclif/plugin-version 2.0.11 (core) @oclif/plugin-warn-if-update-available 3.0.9 (core) @oclif/plugin-which 3.0.14 (core) @salesforce/cli 2.24.4 (core) apex 3.0.17 (core) auth 3.2.0 (core) data 3.0.14 (core) deploy-retrieve 3.1.0 (core) info 3.0.15 (core) limits 3.1.2 (core) marketplace 1.0.16 (core) org 3.2.2 (core) packaging 2.1.0 (core) schema 3.1.0 (core) settings 2.0.15 (core) sobject 1.1.0 (core) source 3.1.3 (core) telemetry 3.1.9 (core) templates 56.0.9 (core) trust 3.3.1 (core) user 3.2.1 (core)

Uninstalled JIT Plugins: community 3.0.12 custom-metadata 3.1.2 dev 2.1.4 devops-center 1.2.5 env 3.0.14 functions 1.22.11 signups 2.0.15 @salesforce/sfdx-plugin-lwc-test 1.1.1 @salesforce/sfdx-scanner 3.19.0

github-actions[bot] commented 9 months ago

Hello @pchittum :wave: It looks like you didn't include the full Salesforce CLI version information in your issue. Please provide the output of version --verbose --json for the CLI you're using (sf or sfdx).

A few more things to check:

Thank you!

github-actions[bot] commented 9 months ago

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

cristiand391 commented 9 months ago

we use the open library to open browsers and we recently saw some cross-platform issues with a few browsers.

does it work if you set firefox as your default browser?

shetzel commented 9 months ago

I can't reproduce this and I have nearly the exact same setup (macos sonoma, firefox 121, zsh, oh my zsh, sf cli 2.25.7). When I run sf org open -b firefox it takes me to the org setup page as expected.

Try this: get the frontdoor url with sf org open -r, then execute the open command. open -a firefox <frontdoor_url>. If you see the same thing happening (firefox launches but not to the url) then it's probably some firefox setting preventing it.

pchittum commented 9 months ago

Thanks for the quick replies.

@cristiand391 Firefox is my default browser. (crazy...I know, but that's how I roll 🤪).

@shetzel I really appreciate the suggestion. When I use open -a firefox <frontdoor-url> the window focus shifts to Firefox, a new tab is created, and I am logged into my org successfully.

pchittum commented 9 months ago

Hmmm...just to check, I tried switching default browser to Chrome, then invoking sf org open -b firefox. Same behavior.

OTOH, I did notice @shetzel that you're on sfcli 2.25. @mshanemc also suggested trying this on the stable RC. Sure enough, I just updated to that version and the behavior goes away.

So there you go. For the record (in the unlikely event someone else is bothered bya Firefox-specific bug) this bug is a behavior that occurs in sfcli version 2.24 and is resolved by installing the 2.25 release candidate using sf update stable-rc. Or just muddle through for a week and run sf update as usual next week and it will be sorted.