Azure / Azure/azure-functions-openapi-extension
No value was provided for parameter 'log' in Functions.RenderSwaggerUI
- Dominant language
- C#
- Stars
- 388
- Forks
- 202
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the issue**
Using dependency injection, getting exception in method 'Functions.RenderSwaggerUI' when attempting to display the Swagger UI page.
**To Reproduce**
Steps to reproduce the behavior:
1. Create an Azure Functions project including Microsoft.Azure.WebJobs.Extensions.OpenApi, and Microsoft.Extendions.Logging packages.
2. Add a derived FunctionsStartup method with 'builder.Services.AddLogging()' as the first statement.
3. Add 'ILogger log' parameters as required to any HttpTrigger class constructors.
4. Compile and execute the project, copying the 'http://localhost:/api/swagger/ui' endpoint into a new browser window.
5. See the following errors in the debug console:
```
Executed 'Functions.RenderSwaggerUI' (Failed, Id=69e04003-c2a6-4fdb-aff6-e8266acf89dd, Duration=269ms)
System.Private.CoreLib: Exception while executing function: Functions.RenderSwaggerUI.
Microsoft.Azure.WebJobs.Host: Exception binding parameter 'log'.
Microsoft.Azure.WebJobs.Host: No value was provided for parameter 'log'.
```
**Expected behavior**
Browser should display the generated Swagger UI.
**Environment (please complete the following information, if applicable):**
- OS: Windows 11 Version 22H2 (Build 22623.1028)
- Browser Edge
- Version 108.0.1462.54 (Official build) (64-bit)
Contributor guide
Research direction
Reproduce the failure at the /api/swagger/ui endpoint and start from the Functions.RenderSwaggerUI entry point, then trace how its log parameter is bound after AddLogging() and ILogger constructor injection are added. Done means the same setup executes successfully and the browser displays the generated Swagger UI without the “No value was provided for parameter 'log'” error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp, openapi
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100