Error when using openapi-red

I'm trying to use openapi-red and when I put in the link for my yaml file and hit the "read" button, I get this:

image

I have tried other yaml files as well and I get the same error. I tried running Node-RED from the console with Trace debugging to see if that showed anything but there wasn't anything that I noticed in there. I also did a Wireshark trace but there was no traffic when hitting the "read" button which makes it seem like it isn't actually trying to reach out.

Has anyone else seen this or have ideas for troubleshooting? I couldn't find the repo on GitHub to post the question there so hopefully someone here can point me in the right direction.

I opened an issue here:

https://gitlab.com/2WeltenChris/openapi-red/-/issues/14

Hi Sauce,

as you can see in the error message, you get an status "404", which means that the file was not found.

On my machine it returns an 406: Not acceptable, which will normaly be "ignored" by a browser.

In practice, this error is very rarely used. Instead of responding using this error code, which would be cryptic for the end user and difficult to fix, servers ignore the relevant header and serve an actual page to the user. It is assumed that even if the user won't be completely happy, they will prefer this to an error code.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/406

That means something on the server side is not correct and the swagger client does not ignore that error.

I will look into it if there is a way to fix this, but if you are in control of the server, you should definitiv check that too.

If I host the file on my server it works as it should.

PS: The Repository can be found here: https://gitlab.com/2WeltenChris/openapi-red

OK. We took a closer look at this issue: The underlying problem is that the server serves the file with a now deprecated media-type text/yaml and swagger-js (the library openapi-red builds upon) sends an accept-header which only contains the now correct media-type application/yaml. Thus the fetch-request will fail with the above mentioned 406 Not acceptable error.

While from our point of view it would be great if swagger-js would accept any media type, it is out of our scope to change this.

For possible workarounds, please take a look at the issue here .

I'm sorry we cannot provide a better solution at the moment.

Edit: Take a look here for more information on the yaml media type.

OK. Finally we found a good solution: Will ignore the media type from version 1.2.4 on upwards. Internally this is done using the request interceptor feature of swagger-js.

Updating to 1.2.4 fixed my 404 issue also. Thanks for the help and the update!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.