eclipse-theia / theia

Eclipse Theia is a cloud & desktop IDE framework implemented in TypeScript.
http://theia-ide.org
Eclipse Public License 2.0
19.93k stars 2.49k forks source link

Extension SQLTools can't add connection. #9544

Open tedyage opened 3 years ago

tedyage commented 3 years ago

Bug Description:

I am a developer using gitpod, which version is 0.6.0_selfhosted. After I open a workspace, I searched and installed the extension named sqltools,and it has been installed properly. There are two icons appended to the sidebar. I click the second icon and then click the "Add new connection" button. Then the SQLTools setting page shows up but it is a blank page. I check the log of the ws-proxy pod, and find out some error messages. { "level": "debug", "message": "proxied request failed", "severity": "DEBUG", "status": "404 Not Found", "time": "2021-06-02T07:53:52Z", "url": "http://ws-e324d221-d01d-41d8-8808-f07dda0a8b10-theia.gitpod.svc.cluster.local:23000/webview/theia-resource/file/tmp/vscode-extensions/mtxr.sqltools@0.23.0/extension/dist/ui/Settings.js" } the hostname of this url is the svc of the pod of the workspace. I try to use curl to access the resource file, and get the same result. The response is 404 Not Found.

curl [pod IP]:23000/webview/theia-resource/file/tmp/vscode-extensions/mtxr.sqltools@0.23.0/extension/dist/ui/Settings.js -v

It looks like the resource file of this extension doesn't exist in the corresponding directory. But when I access into the pod and check the directory, it turns out that the resource files are there. ls /tmp/vscode-extensions/mtxr.sqltools@0.23.0/extension/dist/ui/ commons.css commons.js Results.js Settings.js theme.css vendor.js So I wonder why it can't fetch that resource, which exists in the corresponding directory.

Steps to Reproduce:

  1. Get into a workspace.
  2. Search and install extension SQLTools, wait for it to complete.
  3. Click on the SQLTools icon on the extensions sidebar, and click the "Add new connection" icon, and see what happens.

image

Additional Information

vince-fugnitto commented 3 years ago

@tedyage thank you for the issue :+1:

Theia Version: 0.6.0

The version referenced is quite old (April 30th, 2019), can you confirm the bug still exists on master by building the eclipse-theia/theia repository from sources. In addition, it is worthwhile to confirm the bug is in the framework and not gitpod or the self-hosted version.

tedyage commented 3 years ago

@vince-fugnitto , thank you for your reply. I dived into the workspace container which has extension sqltools installed and found out something relevant to this issue.
The static resources existed in the directory: /tmp/vscode-extensions/mtxr.sqltools@0.23.0/extension/dist/ui/. When I accessed the link below: curl http://0.0.0.0:23000/webview/theia-resource/file/tmp/vscode-extensions/mtxr.sqltools@0.23.0/extension/dist/ui/vendor.js, the response turned out to be 404 Not Found. And then, I change the link, and try the command below: curl http://0.0.0.0:23000/file?/tmp/vscode-extensions/mtxr.sqltools@0.23.0/extension/dist/ui/Settings.js -v, and got the expected response. So is there anything wrong with the resource access URL from the browser?

chris-odell-focs commented 3 years ago

So I had this issue but I didn't fix it by clicking on the 'Add Connection' option. Instead I went into the settings tab and set the connection manually. I then changed to loading the plugin at startup and changed my settings.json file accordingly. TLDR; My settings for the sql tools connection in my docker file ended up being these :

"sqltools.connections": [
    {
        "name": "localdb",
        "server": "db",
        "port": 3306,
        "username": "<my_username>",
        "password": "<my_password>",
        "driver": "MySQL"
    }

obviously you will need to change the and values appropriately.

You should also be able to find the 'sqltools.connections' in your settings in a running theia instance, which should also work.

pkit commented 3 years ago

I can confirm that it doesn't work on current master. Any SQLTools screen that need to show data is not showing anything. No errors in log. Settings: nothing, SQL Results: nothing, etc. SQL Editor works fine though.

pkit commented 3 years ago

Ok, seems like it's because of this "pecularity" in SQLTools https://github.com/mtxr/vscode-sqltools/issues/565