Closed james-wallis closed 4 years ago
Looks like the issue is in this file: https://github.com/eclipse/codewind-appsody-extension/blob/master/templatesProvider.js#L47
I'm aware this is an Appsody issue but we should ensure that we don't crash if the output isn't in JSON.
I've raised this with Appsody here: https://github.com/appsody/appsody/issues/563.
We should still at least add a try/catch when parsing JSON from stdout
.
If the appsody binaries we ship in Codewind will output non-valid json when they detect there's a newer version of appsody available, isn't that going to break existing customers using 0.5.0 @sghung @makandre ?
I'll look into it. I had changed the timestamp in appsody config so it would not do that version check....
So it was a combination of factors of:
0.4.8
)0.4.7
was ignoring that flag0.4.8
in https://github.com/eclipse/codewind-appsody-extension/pull/55 should fix this@makandre I've just seen the PR you've raised. I agree it would fix this but if a check for valid JSON is not added then we run the risk of this issue appearing in production if Appsody release a new version?
@jopit I think this is a major bug as we can't get any PR's into Codewind.
True... I can put in a check for valid JSON in a follow-up PR
Tho in theory after 0.4.8
, it would respect us setting the timestamp so that it would never do the version check
I agree with the theory but as its running an exec command and assuming it returns a JSON object it would be safer to add the valid JSON check. It just protects the off chance that something other than valid JSON is outputted.
@sghung can you re-open this until the fix has been verified in this repo please.
All fixes for this are in now
Happy this is guarded against happening again due to https://github.com/eclipse/codewind/pull/949
Codewind version: Latest OS: MacOS and Jenkins
Description: Portal API
/api/v1/project-types
causes PFE to crash. When the api is called it runs the command${__dirname}/appsody repo list -o json
usingexec
to get a list of repositories from the Appsody CLI. Looks like Appsody has been updated and doesn't give the correct output in JSON so the lineconst json = JSON.parse(stdout);
fails and causes Portal to crash.The
stout
from running the command above in PFE gives the output:and the error given when Portal crashes is:
Steps to reproduce: Pull latest.
./run.sh
curl http://127.0.0.1:{PORTALS_PORT}/api/v1/project-types
Workaround: