question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

swagger.json missing "paths" when deployed as Azure Functions from DevOps

See original GitHub issue

This works locally and works when I publish from VS directly to Azure Functions.

When I run this through DevOps Build Pipeline and Release to Azure Functions everything is working except the “paths” property in the swagger.json file is empty.

Windows target system.

{
  "swagger": "2.0",
  "info": {
    "title": "Azure Functions OpenAPI Extension",
    "version": "1.0.0"
  },
  "host": "........azurewebsites.net",
  "basePath": "/api/v1",
  "schemes": [
    "https"
  ],
  "paths": { }
}

No errors in the Azure Functions LogStream.

2021-06-30T21:02:59.179 [Information] Executing ‘Functions.RenderSwaggerDocument’ (Reason=‘This function was programmatically called via the host APIs.’, Id=000000-c94f-4960-9752-5557d5d998e5) 2021-06-30T21:02:59.180 [Information] swagger.json was requested. 2021-06-30T21:02:59.180 [Information] Executed ‘Functions.RenderSwaggerDocument’ (Succeeded, Id=000000-c94f-4960-9752-5557d5d998e5, Duration=1ms)

What reasons might prevent the “paths” property from populating? I assume it’s dynamically generated at runtime?

Does it require any write permissions to the file system for instance?

It’s hard to debug as it doesn’t appear to show any errors.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:18 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
binarybashercommented, Jul 5, 2021

@justinyoo I prepared the minimum code to send over to you, but then decided to review your yaml settings beforehand.

I noticed that you was performing a restore, build and publish (artifacts) separately and thought I should try this too.

I setup my pipeline in the same way, with the following:

  • dotnet restore . (retrieves resources/packages)
  • dotnet build <project file> -c Release (builds project)
  • dotnet publish <project file> -c Release -o <output folder> (not entirely sure this is necessary, but it basically moves the build files to a publish folder)
  • archive to zip (compresses published build folder, may not be necessary as publish option can zip files)
  • publish build artifacts (published to a artifacts folder reader for a release pipeline to push to Azure)

Interestingly this solved the issue… at least it worked when I tested just now 👍

I guess there’s no need to send the minimum code now 😃

It’s odd that the issue exists though and it’s not entirely clear why, happy to investigate further but it does appear to be build related.

Thanks @justinyoo for your help with this matter.

0reactions
agravity-philippcommented, Sep 12, 2021

Hi @binarybasher ! As you are using Azure DevOps and I ran in the same issue may I ask you to share the pipeline.yaml file?

Hi @justinyoo - Is this solved in 0.9.0-preview (#225) and when will this be released?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Swagger UI not generating in azure .net core but it is ...
this worked for me. Now I am able to see my swagger.json file on my Azure subdomain instead of locally only. I wonder...
Read more >
Azure Functions with Swagger - Kloud Blog
Azure Functions instance automatically converts the YAML document to the JSON one. It seems to be very easy. However, there is a critical...
Read more >
API Versioning with Swagger, Azure API Management ...
I've recently been working with a number of API's that are deployed on Azure behind the Azure API Management Services.
Read more >
Troubleshooting online endpoints deployment and scoring
Learn how to resolve common issues in the deployment and scoring of Azure Machine Learning online endpoints. This document is structured in the ......
Read more >
Guide for running C# Azure Functions in an isolated worker ...
Learn how to use a .NET isolated worker process to run your C# functions in Azure, which supports non-LTS versions of .NET and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found