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.)
cheezsteak
  • 2,731
  • 4
  • 26
  • 41
  • 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? – Mike Walton Jun 17 '21 at 15:33
  • I'm having the same problem, where does the log get saved when you use =o log_level=DEBUG? (on Windows) – datamonk3y Jun 18 '21 at 08:27
  • @datamonk3y 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. – cheezsteak Jun 21 '21 at 13:57
  • @MikeWalton version `1.2.15`, `BROWSER=/usr/bin/firefox` platform is Arch Linux installed using this package https://aur.archlinux.org/packages/snowflake-client/ . Which is on 1.2.14 but the snowsql binary updated itself. – cheezsteak Jun 21 '21 at 14:00
  • Out of curiosity, do you see different behavior if you already have a browser session open? – Mike Walton Jun 21 '21 at 23:04
  • @MikeWalton No. It doesn't matter if my browser is opened or closed. I've also tried other browsers like chromium. – cheezsteak Jun 22 '21 at 14:38
  • 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. – Mike Walton Jun 22 '21 at 19:09
  • 1
    For me I had to update snowsql, and also I had to to unset BROWSER – orellabac Jul 19 '21 at 01:59
  • Having the same on macOS 12.3.1 (apple silicon), `snowsql` 1.2.21 – akauppi Apr 22 '22 at 11:10
  • Is there a Snowflake bug issue on this - that would probably have a better chance of making things work? – akauppi Apr 29 '22 at 10:26

2 Answers2

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
cheezsteak
  • 2,731
  • 4
  • 26
  • 41
  • 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.1` – skyuuka Dec 05 '22 at 06:04
1

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

spcvalente
  • 136
  • 3
  • 14