Open fmannreply opened 8 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.
It's the change in behavior from this PR: https://github.com/salesforcecli/plugin-org/pull/913
My guess is that the temp file is being deleted before the browser can load it. Does this happen 100% of the time for you? Does it matter if Firefox is already open? Does another browser work more consistently?
Can you try modifying this file: /home/fmann/.nvm/versions/node/v20.11.1/lib/node_modules/@salesforce/cli/node_modules/@salesforce/plugin-org/lib/commands/org/open.js
to bump the sleep time so that line 129 is:
await sleep(platform() === 'win32' || isWsl ? 7000 : 10_000);
Let me know if that allows enough time for the redirect. Thanks!
Hi @shetzel, thanks for getting back to me. I did some investigation, tldr even when removing fileCleanup(tempFilePath)
and opening the file manually it doesn't open.
Turns out it's due to snap sandboxing, the global /tmp
is not visible to it, only /home/tmp
and /tmp/snap-private-tmp/snap.firefox/tmp/
. (https://superuser.com/a/1748690). Thats why I also observed the same with chromium as it's also snap.
I will investigate a bit more on what the suggested solution is.
For future reference, see https://github.com/salesforcecli/plugin-org/pull/992#issuecomment-2013234183 for a work around on this issue.
We'll keep this issue open until the tmpfile-based logic is removed.
some notes about the tmp env var workaround:
1) the code tries to delete the file, but even in a failure the default tmp dir is cleaned after a reboot on linux/mac (IIRC that's not the case on windows). If you are setting TMPDIR
make sure the file is getting deleted (it contains a token).
2) another workaround could be running sf org open --url-only --json
and extract the url with jq
, then run open <url>
in your terminal. --url-only
returns an URL with the token in it so make sure it doesn't get logged in the terminal.
Summary
Running
sf org open
under Ubuntu 22.04 with latest sf cli 2.30.8 opens Firefox with "file:////tmp/org-open-1710254619760.html" and shows "File not found".Steps To Reproduce
Expected result
Org opens
Actual result
Org doesn't open and browser shows "File not found".
System Information
Terminal: Bash & Powershell 7.4 (same behavior)
Additional information
The last working version was
@salesforce/cli@2.24.4
. Maybe it has something to do with #923. Workaround is to runsf org open --url-only
and paste the url manually into the browser or pipe it to firefox.