Azure / Azure/azure-functions-openapi-extension

Swagger returns "Invalid function app directory" error when running in docker

Open
#117 1 comment 0 reactions 0 assignees View on GitHub
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
![image](https://user-images.githubusercontent.com/35042188/117758408-fe7f7c80-b1ef-11eb-9a2d-12db0489b40d.png)

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
![image](https://user-images.githubusercontent.com/35042188/117758178-80bb7100-b1ef-11eb-8217-562a66d07efc.png)

![image](https://user-images.githubusercontent.com/35042188/117758205-903aba00-b1ef-11eb-9de5-a5f30d5990af.png)

Any assistance would be appreciated!

Contributor guide

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.