1
votes

When I try to add a swagger endpoint from my logic app it fails even though it successfully fetches the content.

Failed to fetch swagger with error message: Invalid response: {"openapi":"3.0.1","info":{"title":"My Swagger API" ... ... ...} Ensure you have CORS enabled on the endpoint and are calling a valid HTTPS endpoint.

I tried trouble-shooting CORS in every possible way, but in the end what got it working was forcing version 2.0 of swagger: app.UseSwagger(o => o.SerializeAsV2 = true);

Has anyone gotten swagger 3.x to work with Logic Apps?

1
How is the CORS set on the API?Mandar Dharmadhikari
@theabodeofcode right now I have set allow origin "*" in the swagger app service (azure portal).Göran Eliasson
That should be sufficient enough, do you have any custom urls in the allow origin?Mandar Dharmadhikari
@theabodeofcode none, but as I stated above: it works with swagger 2.0, but gives me an error on swagger 3.x with everything else the same.Göran Eliasson
Okay, I will try to replicate this behavior on my endMandar Dharmadhikari

1 Answers

1
votes

Okay, I have replicated the issue on my end and I have observed the same issue with the my open API. The key word to notice here is "OpenAPI" specification. This is not a swagger specification. I found the official document which clearly says Swagger(not OpenAPI). Please refer Call REST endpoints by using Azure Logic Apps

You can try work around for this by creating custom connector