eclipse-archived / codewind

The official repository of the Eclipse Codewind project
https://codewind.dev
Eclipse Public License 2.0
113 stars 45 forks source link

SVT: [VS Code] HTML code in notification when there was an error reconnecting to Local Codewind #1995

Closed sujeilyfonseca closed 4 years ago

sujeilyfonseca commented 4 years ago

Codewind version: Latest OS: Mac OS Mojave 10.14.6

IDE extension version: 0.9.0 IDE version: Code 1.41.1

Description: HTML code in notification when there was an error reconnecting to Local Codewind

Screen Shot 2020-02-03 at 11 12 33 AM

@jagraj

tetchel commented 4 years ago

the real issue here is the 'cannot get /projects', but there's also no reason to still be serving html in error messages. I am using the application/json content-type but text/plain for unexpected errors like this would be ok too.

tobespc commented 4 years ago

@stalleyj can you grab this one please

stalleyj commented 4 years ago

/assign

stalleyj commented 4 years ago

/pipeline in progress

stalleyj commented 4 years ago

It's a strange one but the only way I can see this error happening is if Codewind has been restarted and subsequently, there is a something else running on 127.0.0.1:previousCodewindPort. If there is a server there (ie a python project), it will respond with an html error page. When the plugin attempts to refresh/reconnect, does it assume local Codewind will be on the same port ? @tetchel

tetchel commented 4 years ago

When the plugin attempts to refresh/reconnect, does it assume local Codewind will be on the same port

If you stop/started it through the VS Code UI, then no, it will find the new port If you stop/started it outside of VS Code (eg cwctl, run.sh), you have to run the refresh action to get the plugin to know to update the portal.

stalleyj commented 4 years ago

A bit more playing and I can now see the problem. When Codewind is starting, it creates an Express server and then configures various routes. If a route is called before it is ready, Express returns the html error. With a number of projects, including Appsody ones, there is a number of seconds before the routes are configured. I can only assume that the /v1/projects is being called too soon.

tetchel commented 4 years ago

I found a code path where i will try GET /projects before the connection is 'ready' I will address this