Bug #112994 Cannot create connection with mysql shell extension
Submitted: 7 Nov 2023 17:42 Modified: 5 May 13:06
Reporter: Stefano Taino Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Shell VSCode Extension Severity:S1 (Critical)
Version:1.15.1 OS:Linux (Linux Mint 20.3)
Assigned to: CPU Architecture:x86

[7 Nov 2023 17:42] Stefano Taino
Description:
Follow the instructions but the extension doesn't work..
I already checked that in the system under /etc/ssl/certs there is rootCA.pem and in /usr/local/share/ca-certificates there is rootCA.crt. Also in the config folder of extension there are all certificates. 
Nothing work

How to repeat:
1. Start vscode and install extension
2. Follow welcome wizard for installing certificates
3. Try to make a new connection but failed because rootCA certificates is not installed on the system

Below the debug, output information:
2023-11-07 17:01:50: Info: /home/stefano/.vscode/extensions/oracle.mysql-shell-for-vs-code-1.13.6-linux-x64/shell/bin/mysqlsh   Ver 8.1.1-g2 for Linux on x86_64 - for MySQL 8.1.0 (MySQL Community Server (GPL)) - build 12914698 - commit_id 49c753ad55f63fa4f21f0265ce945071ac54b60f
2023-11-07 17:01:51: Info: Using credential store helper: /home/stefano/.vscode/extensions/oracle.mysql-shell-for-vs-code-1.13.6-linux-x64/shell/bin/mysql-secret-store-login-path
2023-11-07 17:01:51: Info: Setting Python home to '/home/stefano/.vscode/extensions/oracle.mysql-shell-for-vs-code-1.13.6-linux-x64/shell/lib/mysqlsh'
2023-11-07 17:01:51: Info: Loading startup files...
2023-11-07 17:01:51: Info: Loading plugins...
2023-11-07 17:01:52: Info: [MSG] Token read from STDIN
2023-11-07 17:01:52: Info: [MSG] Starting MySQL Shell GUI web server...
2023-11-07 17:01:52: Info: [MSG] 	Checking web server certificate...
2023-11-07 17:01:52: Info: [MSG] 	Certificate is installed.
2023-11-07 17:01:52: Info: [MSG] 	Port: 33336
2023-11-07 17:01:52: Info: [MSG] 	Secure: True
2023-11-07 17:01:52: Info: [MSG] 	Webroot: /home/stefano/.vscode/extensions/oracle.mysql-shell-for-vs-code-1.13.6-linux-x64/shell/lib/mysqlsh/plugins/gui_plugin/core/webroot
2023-11-07 17:01:52: Info: [MSG] 	Mode: Single user
2023-11-07 17:01:53: Info: [MSG] Websocket connected
2023-11-07 17:01:53: Info: [MSG] Registering session...
2023-11-07 17:01:53: Info: [MSG] Sending session response...
2023-11-07 17:01:53: Error: [MSG] Failed to log message in the database.
2023-11-07 17:01:53: Error: [MSG] Exception sending a message. 'request_id'
2023-11-07 17:06:58: Error: [MSG] Failed to log message in the database.

In vscode output extension:
Running on a local VS Code session.
Starting embedded MySQL Shell, using config dir '/home/stefano/.mysqlsh-gui' ...
Please enter the single instance token: 18:1:52.108913 INFO: Token read from STDIN
18:1:52.109680 INFO: Starting MySQL Shell GUI web server...
18:1:52.110075 INFO: 	Checking web server certificate...
18:1:52.110376 INFO: 	Certificate is installed.
18:1:52.117773 DEBUG3: Connecting BackendDB-anonymous...

18:1:52.365553 DEBUG3: Connecting BackendDB-anonymous...
18:1:52.367530 INFO: 	Port: 33336
18:1:52.367720 INFO: 	Secure: True
18:1:52.367785 INFO: 	Webroot: /home/stefano/.vscode/extensions/oracle.mysql-shell-for-vs-code-1.13.6-linux-x64/shell/lib/mysqlsh/plugins/gui_plugin/core/webroot
18:1:52.367838 INFO: 	Mode: Single user

18:1:53.626706 DEBUG: "GET /ws1.ws?token=**** HTTP/1.1" 101 -
18:1:53.627038 INFO: Websocket connected
18:1:53.627525 INFO: Registering session...
18:1:53.628604 DEBUG3: Connecting BackendDB-anonymous...
18:1:53.631116 DEBUG3: Connecting BackendDB-anonymous...

18:1:53.760036 INFO: Sending session response...
18:1:53.761538 ERROR: Failed to log message in the database.
18:1:53.761786 ERROR: Exception sending a message. 'request_id'

18:6:58.488961 DEBUG2: <- {"request_id": "ccc7a591-bd3e-4dab-c176-427f54098ff0", "request": "execute", "command": "mds.list.config_profiles", "kwargs": {}}

18:6:58.489573 ERROR: Failed to log message in the database.

18:6:58.489859 DEBUG2: -> {"request_state": {"type": "ERROR", "msg": "Response cancelled by the application."}, "request_id": "ccc7a591-bd3e-4dab-c176-427f54098ff0"}
[11 Jun 2024 13:03] MySQL Verification Team
Hello Stefano Taino,

Thank you for the bug report.
Please upgrade to latest version and report us back if issue persist even in latest version along with details. Thank you.

Regards,
Ashwini Patil
[12 Jul 2024 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[14 Jul 2024 13:45] Stefano Taino
Hi,
unfortunately the bug persists.

I've updated the mysql shell extension of vscode to the version v1.15.1 (latest now). I've also updated vscode on version 1.91.1 (latest now). I've also updated the internal mysql server on version 8.0.37 (latest now).

I follow the instructions but the extension doesn't work..
After welcome wizard, in ~/.mysqlsh-gui/plugin_data/gui_plugin/web_cert I have:
rootCA.crt, server.crt, server.key (all created after the welcome wizard).

I also tried to use the following commands to copy the rootCA.crt into my certificate storage:
sudo cp rootCA.crt /usr/local/share/ca-certificates/rootCA.crt
sudo update-ca-certificates

Output:
Updating certificates in /etc/ssl/certs...
rehash: warning: skipping ca-certificates.crt,it does not contain exactly one certificate or CRL
1 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...

Adding debian:rootCA.pem
done.
done.

I've also checked the mysql is running:
systemctl status mysql.service

Output:
● mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; disabled; vendor preset: enabled)
     Active: active (running) since Sun 2024-07-14 15:25:55 CEST; 1s ago
    Process: 66135 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
   Main PID: 66161 (mysqld)
     Status: "Server is operational"
      Tasks: 38 (limit: 18943)
     Memory: 369.7M
     CGroup: /system.slice/mysql.service
             └─66161 /usr/sbin/mysqld

After welcome wizard, I've the following outputs.

On mysql shell extension. It appers when I start vscode and try to connect to db:

Running on a local VS Code session.
Starting embedded MySQL Shell, using config dir '/home/stefano/.mysqlsh-gui' ...
Please enter the single instance token: 
15:40:15.321458 INFO: Token read from STDIN
15:40:15.321544 INFO: Starting MySQL Shell GUI web server...
15:40:15.321728 INFO: 	Checking web server certificate...

15:40:15.321938 INFO: 	Certificate is installed.

15:40:15.327073 DEBUG3: Connecting BackendDB-anonymous...

15:40:15.579350 DEBUG3: Connecting BackendDB-anonymous...

15:40:15.679746 INFO: 	Port: 33336

15:40:15.679968 INFO: 	Secure: True
15:40:15.680038 INFO: 	Webroot: /home/stefano/.vscode/extensions/oracle.mysql-shell-for-vs-code-1.15.1-linux-x64/shell/lib/mysqlsh/plugins/gui_plugin/core/webroot
15:40:15.680085 INFO: 	Mode: Single user

15:40:15.689047 DEBUG: "GET /ws1.ws?token=**** HTTP/1.1" 101 -

15:40:15.689224 INFO: Websocket connected

15:40:15.689415 INFO: Registering session...
15:40:15.689661 DEBUG3: Connecting BackendDB-anonymous...
15:40:15.690324 DEBUG3: Connecting BackendDB-anonymous...

15:40:15.806375 INFO: Sending session response...

15:40:15.990561 DEBUG2: -> {"request_state": {"type": "OK", "msg": "A new session has been created"}, "session_uuid": "9a2ff9d2-41e6-11ef-8392-05bf9c111253", "local_user_mode": true}
15:40:16.4441 DEBUG2: <- {"request_id": "41f84373-07a7-4e08-b298-45609724b768", "request": "authenticate", "username": "LocalAdministrator", "password": "****"}

15:40:16.233904 DEBUG3: Connecting 9a2ff9d2-41e6-11ef-8392-05bf9c111253...
15:40:16.234825 DEBUG3: Connecting 9a2ff9d2-41e6-11ef-8392-05bf9c111253...
15:40:16.235674 DEBUG3: Connecting BackendDB-anonymous...
15:40:16.236595 DEBUG3: Connecting BackendDB-anonymous...
15:40:16.418313 DEBUG2: -> {"request_state": {"type": "OK", "msg": "User LocalAdministrator was successfully authenticated."}, "request_id": "41f84373-07a7-4e08-b298-45609724b768", "active_profile": {"id": 1, "user_id": 1, "name": "Default", "description": "Default Profile", "options": {"theming": {"themes": [], "current_theme": "Auto"}, "workers": {"min_worker_count": 3, "max_worker_count": 3, "max_pending_task_count": 100, "remove_idle_time": 60}, "editor": {"word_wrap": "on", "word_wrap_column": 120, "show_hidden": false, "db_version": "", "sql_mode": "", "stop_on_errors": false, "show_minimap": true, "edit_on_double_click": true, "theming": {"decoration_set": "standard"}}, "db_editor": {"start_language": "sql", "default_editor": "notebook", "use_minimap": false, "upper_case_keywords": true, "connection_browser": {"show_greeting": true}}, "sql": {"limit_row_count": 1000, "row_packet_size": 1000}, "shell_session": {"start_language": "javascript", "session_browser": {"show_greeting": true}}}}}

15:40:16.430718 DEBUG2: <- {"request_id": "ca454894-6ffb-4d01-96e0-df4881be765f", "request": "execute", "command": "gui.modules.list_data_categories", "args": {}}

15:40:16.779124 DEBUG2: -> {"request_state": {"type": "PENDING", "msg": ""}, "result": [{"id": 1, "name": "Text", "parent_category_id": null}], "request_id": "ca454894-6ffb-4d01-96e0-df4881be765f"}
15:40:16.888211 DEBUG2: -> {"request_state": {"type": "OK", "msg": ""}, "request_id": "ca454894-6ffb-4d01-96e0-df4881be765f", "done": true}
15:40:17.42063 DEBUG2: <- {"request_id": "753e5ddc-7043-4e9a-dd82-aa5672f9bea9", "request": "execute", "command": "gui.dbconnections.list_db_connections", "args": {"profile_id": 1, "folder_path": ""}}

15:40:17.495712 DEBUG2: <- {"request_id": "c4f4ef2a-323f-4959-ea1f-f0fcf2714229", "request": "execute", "command": "mds.list.config_profiles", "kwargs": {}}

15:40:18.131476 DEBUG2: -> {"request_state": {"type": "PENDING", "msg": ""}, "result": [], "request_id": "753e5ddc-7043-4e9a-dd82-aa5672f9bea9"}

15:40:18.348286 DEBUG2: -> {"request_state": {"type": "OK", "msg": ""}, "request_id": "753e5ddc-7043-4e9a-dd82-aa5672f9bea9", "done": true}

15:40:18.665672 DEBUG2: -> {"request_state": {"type": "PENDING", "msg": ""}, "result": [], "request_id": "c4f4ef2a-323f-4959-ea1f-f0fcf2714229"}

15:40:18.842655 DEBUG2: -> {"request_state": {"type": "OK", "msg": ""}, "request_id": "c4f4ef2a-323f-4959-ea1f-f0fcf2714229", "done": true}

15:40:18.890770 DEBUG2: <- {"request_id": "4cecd764-34e0-4c72-b344-00d9880fe675", "request": "execute", "command": "mds.list.config_profiles", "kwargs": {}}

15:40:19.261732 DEBUG2: -> {"request_state": {"type": "PENDING", "msg": ""}, "result": [], "request_id": "4cecd764-34e0-4c72-b344-00d9880fe675"}

15:40:19.404032 DEBUG2: -> {"request_state": {"type": "OK", "msg": ""}, "request_id": "4cecd764-34e0-4c72-b344-00d9880fe675", "done": true}

On mysqlsh.log:

2024-07-14 13:40:14: Info: /home/stefano/.vscode/extensions/oracle.mysql-shell-for-vs-code-1.15.1-linux-x64/shell/bin/mysqlsh   Ver 9.0.0 for Linux on x86_64 - for MySQL 9.0.0 (MySQL Community Server (GPL)) - build 16040773 - commit_id ada858aee4c7efef1dc4e61c358f787204e6146a - product_id linux-glibc2.28-x86-64bit tar-gz
2024-07-14 13:40:14: Info: Using credential store helper: /home/stefano/.vscode/extensions/oracle.mysql-shell-for-vs-code-1.15.1-linux-x64/shell/bin/mysql-secret-store-login-path
2024-07-14 13:40:14: Info: Setting Python home to '/home/stefano/.vscode/extensions/oracle.mysql-shell-for-vs-code-1.15.1-linux-x64/shell/lib/mysqlsh'
2024-07-14 13:40:14: Info: Loading startup files...
2024-07-14 13:40:14: Info: Loading plugins...
2024-07-14 13:40:15: Info: [MSG] Token read from STDIN
2024-07-14 13:40:15: Info: [MSG] Starting MySQL Shell GUI web server...
2024-07-14 13:40:15: Info: [MSG] 	Checking web server certificate...
2024-07-14 13:40:15: Info: [MSG] 	Certificate is installed.
2024-07-14 13:40:15: Info: [MSG] 	Port: 33336
2024-07-14 13:40:15: Info: [MSG] 	Secure: True
2024-07-14 13:40:15: Info: [MSG] 	Webroot: /home/stefano/.vscode/extensions/oracle.mysql-shell-for-vs-code-1.15.1-linux-x64/shell/lib/mysqlsh/plugins/gui_plugin/core/webroot
2024-07-14 13:40:15: Info: [MSG] 	Mode: Single user
2024-07-14 13:40:15: Info: [MSG] Websocket connected
2024-07-14 13:40:15: Info: [MSG] Registering session...
2024-07-14 13:40:15: Info: [MSG] Sending session response...

How to repeat:
1. Start vscode and install extension
2. Follow welcome wizard for installing certificates
3. Try to make a new connection but failed because rootCA certificates is not installed on the system

Maybe the problem is on the gui but I don't know.

Thank you again for the support.

Stefano Taino
[5 May 13:06] MySQL Verification Team
Hello Stefano Taino,

Thank you for the details.

For more info about set Up MySQL Shell for VS Code, please see
https://dev.mysql.com/doc/mysql-shell-gui/en/mysql-shell-for-vscode-setup.html

Please note that MySQL Shell for VS Code extension is not yet tested against Linux Mint.

Regards,
Ashwini Patil