Azure / azure-functions-openapi-extension

This extension provides an Azure Functions app with Open API capability for better discoverability to consuming parties
https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi/
MIT License
375 stars 196 forks source link

Setting the base url in isolated worker azure function #639

Closed Glowiksi closed 10 months ago

Glowiksi commented 10 months ago

Describe the issue Hello,

I currently have an azure function isolated-worker running on my local machine and after setting up swagger it takes another port as the default one. Therefore it can not load the swagger.json nor call the api because of CORS and wrong setup.

Setup: MacBook Pro M2 or Windows 10 (Dell) Jetbrains Rider .NET 8 Microsoft.Azure.Functions.Worker.Extensions.OpenApi 1.5.1

To Reproduce Steps to reproduce the behavior:

  1. Start your app to port 7071 - which is needed in my case.
  2. Open the swagger ui
  3. Get a big red banner with an error
  4. See the base url on the top left has not changed

Expected behavior I expect to set the baseurl in the IOpenApiConfigurationOptions. The attribute "Servers" has no outcome to the app.

Screenshots image image

slaneyrw commented 10 months ago

This is resolved by https://github.com/Azure/azure-functions-dotnet-worker/pull/2149 and is in the latest Worker nuget packages

Glowiksi commented 10 months ago

@slaneyrw Thanks for the reply and the work you have provided. It did fix my issue.

For future search: when running into this issue also make sure to remove the "Server = ..GetHostNames()" this will lead to other routing issues.