'Why isn't snowsql opening an external browser?

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.)


Solution 1:[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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1