Why isn't snowsql opening an external browser?
Asked Answered
S

3

7

I'm trying to get snowsql working locally on my machine but I cannot log into my database because it requires that I authenticate with my google account for SSO. The documentation says to use the --authenticator externalbrowser option which should open a local browser and ask me to sign on but that doesn't happen, nothing happens.

Example:

$ snowsql -o log_level=DEBUG -a <account> -u <gmail> --authenticator externalbrowser
Initiating login request with your identity provider. A browser window should have opened for you to complete the login. If you can't see it, check existing browser windows, or your OS settings. Press CTRL+C to abort and try again...

No browser windows open. Pressing CTRL+C does not abort snowsql; I must run pkill to kill it. The last of my logs show

2021-06-17 14:48:12,211 (222954/MainThread) snowflake.connector.network DEBUG        network:940  - SUCCESS
2021-06-17 14:48:12,212 (222954/MainThread) snowflake.connector.network DEBUG        network:1096 - Active requests sessions: 0, idle: 1
2021-06-17 14:48:12,212 (222954/MainThread) snowflake.connector.network DEBUG        network:642  - ret[code] = None, after post request
2021-06-17 14:48:12,212 (222954/MainThread) snowflake.connector.auth_webbrowser DEBUG auth_webbrowser:123  - step 2: open a browser
2021-06-17 14:48:12,237 (222954/MainThread) snowflake.connector.auth_webbrowser DEBUG auth_webbrowser:136  - step 3: accept SAML token

platform:

  • Platform is Arch Linux (kernel version 5.12.10)
  • Default browser is BROWSER=/usr/bin/firefox
  • snowsql --version says 1.2.15
  • Installed via snowflake-client AUR package. (Which currently says version 1.2.14 but I believe snowsql updated itself to 1.2.15.)
Spang answered 17/6, 2021 at 14:57 Comment(10)
Can you confirm that you are running the latest SnowSQL version and also provide the OS that you are running SnowSQL on? Also, what is your default browser?Convict
I'm having the same problem, where does the log get saved when you use =o log_level=DEBUG? (on Windows)Brigadier
@Brigadier I had to set the log path in ~/.snowsql/config to ~/.local/share/snosql.log because it was defaulting to ../snowsql.log which could be /home/snowsql.log which it couldn't write to.Spang
@MikeWalton version 1.2.15, BROWSER=/usr/bin/firefox platform is Arch Linux installed using this package aur.archlinux.org/packages/snowflake-client . Which is on 1.2.14 but the snowsql binary updated itself.Spang
Out of curiosity, do you see different behavior if you already have a browser session open?Convict
@MikeWalton No. It doesn't matter if my browser is opened or closed. I've also tried other browsers like chromium.Spang
Hmm. I'm not a Linux expert, so not sure I can assist you further. You might want to reach out to Snowflake Support and see if they have a solution for you. I'm not entirely sure that the externalbrowser supports Linux environments, but I don't know that for sure.Convict
For me I had to update snowsql, and also I had to to unset BROWSERRectify
Having the same on macOS 12.3.1 (apple silicon), snowsql 1.2.21Ballplayer
Is there a Snowflake bug issue on this - that would probably have a better chance of making things work?Ballplayer
S
1

See this answer for why snowsql isn't working. tl;dr it bundles it's own version of libz and doesn't use the system's version when opening your browser.

Based on that answer I concocted a little script to replace the bundled libz with the system libz. You'll need to run it whenever snowflake updates.

#!/usr/bin/env bash

VERSION=$(snowsql --version | cut -d' ' -f2)
LIBS="$HOME/.snowsql/$VERSION"
LIBZ="$LIBS/libz.so.1"
if ! [[ -L $LIBZ ]]
then
  mv -v $LIBZ{,-bak}
fi
SYSTEM=$(sudo find /usr -name libz.so* 2> /dev/null | head -n1)
ln -sfv $SYSTEM $LIBZ
Spang answered 4/5, 2022 at 15:32 Comment(1)
In my case, there is no libz.so.1 but only libz.so in the system folder. soft link libz.so to libz.so.1 works for me. ln -s /usr/lib/x86_64-linux-gnu/libz.so ~/.snowsql/1.2.24/libz.so.1Scope
E
2

for me, setting the --region flag solved it, even though it's deprecated, according to the official documentation

Eyecup answered 21/6, 2022 at 11:45 Comment(0)
S
1

See this answer for why snowsql isn't working. tl;dr it bundles it's own version of libz and doesn't use the system's version when opening your browser.

Based on that answer I concocted a little script to replace the bundled libz with the system libz. You'll need to run it whenever snowflake updates.

#!/usr/bin/env bash

VERSION=$(snowsql --version | cut -d' ' -f2)
LIBS="$HOME/.snowsql/$VERSION"
LIBZ="$LIBS/libz.so.1"
if ! [[ -L $LIBZ ]]
then
  mv -v $LIBZ{,-bak}
fi
SYSTEM=$(sudo find /usr -name libz.so* 2> /dev/null | head -n1)
ln -sfv $SYSTEM $LIBZ
Spang answered 4/5, 2022 at 15:32 Comment(1)
In my case, there is no libz.so.1 but only libz.so in the system folder. soft link libz.so to libz.so.1 works for me. ln -s /usr/lib/x86_64-linux-gnu/libz.so ~/.snowsql/1.2.24/libz.so.1Scope
T
0

spcvalente's solution worked for me... I have no idea why.

I added the --region us-east-1 flag and it all worked.

My full command was

snowsql -a {my account ID} -u {my user} --authenticator externalbrowser --region us-east-1

Twister answered 26/3, 2024 at 21:52 Comment(1)
Please don't add "thank you" as an answer. Instead, vote up the answers that you find helpful. - From ReviewFiduciary

© 2022 - 2025 — McMap. All rights reserved.