Azure / Azure/azure-functions-openapi-extension
Swagger returns "Invalid function app directory" error when running in docker
- Dominant language
- C#
- Stars
- 388
- Forks
- 202
- PR merge metrics
- No merged PRs in 30d
Description
Running a function app locally in docker compose attempting to use swagger to generate open api definitions without having to run them in Visual Studio. When running function in Visual Studio there are no issues accessing the swagger UI or other swagger resources, only when running in docker.
I've narrowed it down to this line where the Swagger extension is failing, but unsure as to why. https://github.com/Azure/azure-functions-openapi-extension/blob/6da2e2b4c8bfc4d19612e17b5bdaf8ac9e25a49d/src/Microsoft.Azure.WebJobs.Extensions.OpenApi/OpenApiHttpTriggerContext.cs#L245
Below is an output of the serialized output of the ExecutionContext printed to the console when the function runs
```
{
"InvocationId":"3d793116-b140-4e29-9c18-db4ed450272e",
"FunctionName":"AutoCompletePlace",
"FunctionDirectory":"/home/site/wwwroot/AutoCompletePlace",
"FunctionAppDirectory":"/home/site/wwwroot",
"RetryContext":null}
```
below is a screenshot of the `~/site/wwwroot/bin` directory inside the running docker container

As you can see, from the above screen shots, the function.deps.json obviously exists in the running docker container.
Below is some additional screenshots. Note I am running the docker container in developement mode using
```ENV AZURE_FUNCTIONS_ENVIRONMENT=Development``` in the Dockerfile


Any assistance would be appreciated!
Contributor guide
Research direction
Start with src/Microsoft.Azure.WebJobs.Extensions.OpenApi/OpenApiHttpTriggerContext.cs at line 245 and reproduce the Swagger request through the reported docker compose setup. Compare the serialized ExecutionContext paths with the function.deps.json location in the container; done means Swagger UI and its other resources work when the function runs in Docker.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp, docker, openapi
- Domain
- api, backend, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100