data-api-builder

"Your connection is not private" net::ERR_CERT_AUTHORITY_INVALID with https://localhost:5001 and Data API builder


When I first start using Data API builder on a clean machine, navigating to https://localhost:5001 in Microsoft Edge returns the following error:

net::ERR_CERT_AUTHORITY_INVALID

How can I interact with my endpoints https://localhost:5001/swagger, https://localhost:5001/openapi, and https://localhost:5001/graphql


Solution

  • Data API builder uses ASPNET Core behind the scenes and suffers from some of the same developer-oriented speed bumps required to get localhost working.

    This is closely related to a known issue with the engine that requires the ASPNETCORE_URLS environment variable to be set in order to get https in the first place. https://github.com/Azure/data-api-builder/issues/2237

    However, in this case, the error you are experiencing requires two steps to resolve.

    1. Trust your development certificates

    dotnet dev-certs https --trust
    

    When you run this command in Windows, you will be prompted to trust development certs. This is required. Click yes and your machine will be configured for localhost.

    2. Enable insecure localhost in Microsoft Edge

    Open Microsoft Edge and navigate to edge://flags. In this settings page, you can search for a setting. Search for either "insecure" or "localhost" and find the setting for --allow-insecure-localhost. It should be Disabled by default, you want to toggle it to Enabled. That should do it.

    enter image description here

    This usually occurs when you are using .NET 8 without .NET 6 installed. But regardless of your configuration, this is the resolution you need.

    Best of luck!