Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
330 stars 56 forks source link

Github action fails: Error in processing api build artifacts: the host.json file cannot specify a http.routePrefix value other than 'api'. #1491

Closed gentledepp closed 4 months ago

gentledepp commented 4 months ago

Describe the bug

A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Create new azure funciton project
  2. change routePrefix in host.json file to empty string
  3. Add some function that registers at the root:

     [FunctionName("redirector")]
        public static async Task<IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "{*ignored}")] HttpRequest req,
            ILogger log)
        {
    
            var url = $"someotherscheme://{req.Host}{req.Path}{req.QueryString}";
    
            log.LogInformation($"Redirecting to {url}");
    
            return new RedirectResult(url);
        }
  4. Deploy using github actions
  5. See error

    Error in processing api build artifacts: the host.json file cannot specify a http.routePrefix value other than 'api'.

However, the docs state that this should be possible: https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook-trigger?tabs=python-v2%2Cisolated-process%2Cnodejs-v4%2Cfunctionsv2&pivots=programming-language-csharp#customize-the-http-endpoint

Expected behavior Have ny

Screenshots If applicable, add screenshots to help explain your problem.

Device info (if applicable):

Additional context Add any other context about the problem here.

gentledepp commented 4 months ago

Forget it. This was because I was following the tutorial:

which suggests adding a new funciton app using the VS Code extension which uses the deprecated model....