The Database Connection Smart cell isn't working on Windows 10

Running on Windows 10, Livebook v0.12.1, Elixir v1.15.7 and the latest Firefox or Chrome.

Hi,

I’m running into an issue when trying to set up a database connection using a Smart cell in Livebook.

  • Start with a blank Notebook.
  • Click on the +Smart cell and note the sub-menu showing MySQL, SQLite, SQLServer etc appears.
  • Click on any of the sub-menu items (e.g. SQLIte or MySQL) and you will be informed that the “Database connection“ smart cell requires certain packages and asked whether you would like to add them as dependencies and restart.
  • Click “Add and restart” and wait for the Dependencies and Setup cell to re-evaluate.
  • Click on the +Smart cell and note the sub-menu showing is no longer visible.
  • Edit the Dependencies and Setup cell, remove {:kino_db, “~> 0.2.3”} and re-evaluate.
  • Click on the +Smart cell and note the sub-menu showing is now visible again.

I’ve checked the logs and nothing is reported there other than the starting of the Livebook Application. Viewing Chrome/Firefox DevTools doesn’t show any errors when the Smart cell is clicked. I’ve tried in multiple browsers, disabled anti-virus, disabled extensions etc and nothing changes the behaviour.

Any help appreciated.


2024-02-06 16_25_02-Untitled notebook - Livebook — Mozilla Firefox

This is by design. See the answers in this thread: Group Livebook Smart Cells in Parent Item in Dropdown

Hi @mruoss

Thanks for the response.

I’ve read that link and I may have misled you - I’m not trying to change the grouping, I’m just trying to connect to a MS SQLServer database as shown in the announcement video: Integration with Snowflake and Microsoft SQL Server - Launch Week 2 - Day 4 - Livebook.dev - The Livebook Blog

In my Notebook, the Smart cell that provides the input form for the database credentials never appears.
2024-02-06 18_25_13-Integration with Snowflake and Microsoft SQL Server - Launch Week 2 - Day 4 - Li

I had assumed that I needed to re-add it, which I can not do because the secondary menu subsequently disappears. But after re-watching that video, I think it should appear immediately after the dependencies are automatically added & re-evaluated.

In my case, I just end up with the database smart cell showing as “not available” and no way to add a new database connection via the menu.

I can convert the Smart cell to a Code cell and verify that I can connect to the DB, but that renders the subsequent Smart cells useless:

Maybe the title would be better as Database Connection Smart cells don’t work on Windows 10.

Maybe I don’t understand correctly. Once the dependency is installed, there is no submenu anymore. You just click on “Database Connection” to add the smart cell and select the type within the Smart Cell:

Ooooh… Now I get you. The smart cell you’ve added just shows “Not available”! Sorry, I missed that part. Yeah… nothing I can help with.

Except further possibilities to debug:

  • Check the browser logs
  • Start livebook with LIVEBOOK_DEBUG=true

Just tried on a Linux machine and it worked immediately:

I’ll try again with the debug option turned on.

Just adding that installing Livebook from source had exactly the same behaviour as running via the integrated Windows download.

The workaround I am using is to run it in a VM which works without issue - so it’s definitely something wrong with my machine (probably security software).

1 Like

Is there anything in the browser console?

1 Like

Not really anything that sticks out.

INITIAL LIVEBOOK FINISHED LOADING
11:31:19.970 [debug] HANDLE PARAMS in LivebookWeb.HomeLive
  Parameters: %{}
11:31:19.971 [debug] Replied in 647µs
11:31:19.980 [debug] MOUNT LivebookWeb.SessionLive
  Parameters: %{"id" => "7tuu2iyiizcgy5vuslr7mhvvex6xtghn3pg6rlsjqkzrcuyd"}
  Session: %{"8080:token" => <<124, 194, 153, 69, 141, 10, 180, 210, 245, 198, 114, 191, 169, 36, 55, 171, 251, 102, 128, 95, 66, 212, 207, 172, 93, 114, 158, 144, 29, 147, 87, 114>>, "_csrf_token" => "Gf-9qzsxz9q8OY_6kXqnHYDe", "current_user_id" => "clt3w3bbvjzhed3kyovpdfcrlhhejfgg", "identity_data" => %{id: "clt3w3bbvjzhed3kyovpdfcrlhhejfgg"}, "user_data" => %{"email" => nil, "hex_color" => "#F87171", "id" => "clt3w3bbvjzhed3kyovpdfcrlhhejfgg", "name" => nil}}
11:31:20.719 [debug] Replied in 740ms
11:31:20.720 [debug] HANDLE PARAMS in LivebookWeb.SessionLive
  Parameters: %{"id" => "7tuu2iyiizcgy5vuslr7mhvvex6xtghn3pg6rlsjqkzrcuyd"}
11:31:20.720 [debug] Replied in 92µs
11:31:34.519 [debug] HANDLE EVENT "insert_smart_cell_below" in LivebookWeb.SessionLive
  Parameters: %{"cell_id" => "f6hpr6c6y6n2cej5", "kind" => "Elixir.KinoDB.ConnectionCell", "preset_idx" => 3, "section_id" => "zrup7f7cciisah43", "value" => ""}
11:31:34.520 [debug] Replied in 612µs

ADD DATABASE SMARTCELL
11:31:53.544 [info] CONNECTED TO LivebookWeb.Socket in 24µs
  Transport: :websocket
  Serializer: Phoenix.Socket.V2.JSONSerializer
  Parameters: %{"_csrf_token" => "P15EXgQ9AUgicEQAeD5tUzIrGh44FzU1x8iguGr0XI587g2eYskppNqP", "vsn" => "2.0.0"}
11:31:55.969 [debug] HANDLE EVENT "confirm" in LivebookWeb.SessionLive
  Parameters: %{}
11:31:56.636 [debug] Replied in 666ms
11:32:01.709 [debug] HANDLE EVENT "report_cell_revision" in LivebookWeb.SessionLive
  Parameters: %{"cell_id" => "setup", "revision" => 1, "tag" => "primary"}
11:32:01.709 [debug] Replied in 166µs
11:32:12.211 request_id=F7OTYdvF1xwBkaIAAALM [info] GET /public/sessions/7tuu2iyiizcgy5vuslr7mhvvex6xtghn3pg6rlsjqkzrcuyd/assets/tngzhkqmn75fgj6yfczabogffa/main.js
11:32:12.212 request_id=F7OTYdvF1xwBkaIAAALM [debug] Processing with LivebookWeb.SessionController.show_asset/2
  Parameters: %{"file_parts" => ["main.js"], "hash" => "tngzhkqmn75fgj6yfczabogffa", "id" => "7tuu2iyiizcgy5vuslr7mhvvex6xtghn3pg6rlsjqkzrcuyd"}
  Pipelines: [:js_view_assets]
11:32:12.212 request_id=F7OTYdvF1xwBkaIAAALM [info] Sent 301 in 538µs

DEEPENDENCIES INSTALLED
DE11:32:17.161 [debug] HANDLE EVENT "report_cell_revision" in LivebookWeb.SessionLive
  Parameters: %{"cell_id" => "cvc3tor7y3d4yv6o", "revision" => 1, "tag" => "primary"}
11:32:17.161 [debug] Replied in 161µs
11:32:25.702 [debug] HANDLE EVENT "queue_cell_evaluation" in LivebookWeb.SessionLive
  Parameters: %{"cell_id" => "f6hpr6c6y6n2cej5", "disable_dependencies_cache" => false}
11:32:25.702 [debug] Replied in 172µs

SMART CELL SHOWS "NOT AVAILABLE"
11:32:48.504 [debug] HANDLE EVENT "insert_smart_cell_below" in LivebookWeb.SessionLive
  Parameters: %{"cell_id" => "cvc3tor7y3d4yv6o", "kind" => "Elixir.KinoDB.ConnectionCell", "preset_idx" => nil, "section_id" => "zrup7f7cciisah43", "value" => ""}
11:32:48.504 [debug] Replied in 255µs
11:32:48.628 request_id=F7OTalZekqQBkaIAAAMM [info] GET /public/sessions/7tuu2iyiizcgy5vuslr7mhvvex6xtghn3pg6rlsjqkzrcuyd/assets/tngzhkqmn75fgj6yfczabogffa/main.js
11:32:48.628 request_id=F7OTalZekqQBkaIAAAMM [debug] Processing with LivebookWeb.SessionController.show_asset/2
  Parameters: %{"file_parts" => ["main.js"], "hash" => "tngzhkqmn75fgj6yfczabogffa", "id" => "7tuu2iyiizcgy5vuslr7mhvvex6xtghn3pg6rlsjqkzrcuyd"}
  Pipelines: [:js_view_assets]
11:32:48.628 request_id=F7OTalZekqQBkaIAAAMM [info] Sent 301 in 433µs
11:32:53.617 [debug] HANDLE EVENT "report_cell_revision" in LivebookWeb.SessionLive
  Parameters: %{"cell_id" => "rnigsk3ojbosp673", "revision" => 1, "tag" => "primary"}
11:32:53.617 [debug] Replied in 178µs
11:32:55.159 [info] CONNECTED TO LivebookWeb.Socket in 32µs
  Transport: :websocket
  Serializer: Phoenix.Socket.V2.JSONSerializer
  Parameters: %{"_csrf_token" => "P15EXgQ9AUgicEQAeD5tUzIrGh44FzU1x8iguGr0XI587g2eYskppNqP", "vsn" => "2.0.0"}

Same goes for the browser console. There’s only one error and that looks transient:

The connection to ws://localhost:8080/socket/websocket?_csrf_token=P15EXgQ9AUgicEQAeD5tUzIrGh44FzU1x8iguGr0XI587g2eYskppNqP&vsn=2.0.0 was interrupted while the page was loading.