Closed sujeilyfonseca closed 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.
@stalleyj can you grab this one please
/assign
/pipeline in progress
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
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.
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.
I found a code path where i will try GET /projects before the connection is 'ready' I will address this
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
@jagraj