Not supporting Microsoft.Azure.Functions.Worker.Sdk version 1.16.0
Strandfelt opened this issue · comments
Describe the issue
When upgrading the Microsoft.Azure.Functions.Worker.Sdk
package to 1.16.0
which was released on November 7, the Open API is not able to generate if there are HTTP triggers.
It is worth to note that in a vanilla function project with NO triggers, the documents will actually be rendered, but when you add an HTTP triggered function to the project, the Open API endpoints will vanish.
To Reproduce
Steps to reproduce the behavior:
- Create vanilla
dotnet-isolated
Azure Function referencingMicrosoft.Azure.Functions.Worker.Sdk
1.15.1
without any Functions- E.g.
func init MyOpenApiFunctionApp --worker-runtime dotnetIsolated --target-framework net7.0
- E.g.
- Add
Microsoft.Azure.Functions.Worker.Extensions.OpenApi
1.5.1
- See that Open API documents are generated (with no Function routes)
- Upgrade
Microsoft.Azure.Functions.Worker.Sdk
to1.16.0
- See that Open API documents are generated (with no Function routes)
- Add an HTTP triggered function with Open API attributes
- See that Open API documents are no longer generated
- Downgrade
Microsoft.Azure.Functions.Worker.Sdk
to1.15.1
- See that Open API documents are generated again (now with Function routes)
Expected behavior
Open API documents are generated for a Functions project referencing Microsoft.Azure.Functions.Worker.Sdk
package to 1.16.0
when there are triggers in the project
Environment (please complete the following information, if applicable):
- TargetFramework:
net7.0
- AzureFunctionsVersion:
v4
- OS: Windows
This issue also exists in net6.0. Spend couple of hours to fix and find out what I did wrong. It happens exactly as in the above description.
I can confirm the same issue in 1.16.0, and as well in 1.16.1. Rolling back to 1.15.1 solves the issue and the http trigger endpoints for OpenAPI reappears. On .net7 and v4 and Windows. All other nugets on latest versions.
So, I've discovered more details about the issue. Since the referenced assembly, that holds the OpenAPI, contains the function http triggers and the old behaviour of the Microsoft.Azure.Functions.Worker.Sdk was to scan ALL assemblies for functions, internal or public, and register them it worked fine.
I have my own set of nugets, that contain internal function triggers (timers). They also dissappear with the 1.16.0 SDK. So, the issue has nothing to do with the http or OpenAPI, but seems to be a change in scanning/discovery of triggers in other assemblies than the "main assembly".
Can also confirm the issue with Microsoft.Azure.Functions.Worker.Sdk 1.16.x
where 1.15.1 works.
irm the issue with
Microsoft.Azure.Functions.Worker.Sdk 1.16.x
where 1.15.1 works.
For me this is also the case
Just ran into this. Can confirm also - have had to downgrade to 1.15.1. Well done for opening this @Strandfelt.
Please see Azure/azure-functions-dotnet-worker#2052 (comment)
Yes this release works for me, thank you for the fast implementation of the solution.
Yes, 1.16.2 release solves the problem. Thank you.
This issue should be closed, since it's a problem that doesn't originate in this repo's code.