You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary
I'm setting up a Functions app to serve static a static site from blob storage, with the api endpoints hosted in the function app. Some of the functions have the same route, but they are configured to handle different HTTP methods.
When I don't include my proxies.json file in my build, I can route to the correct functions (by HTTP method) without an issue.
Once I include proxies.json in the build build, every "question" request goes to the "PostQuestion" Function, regardless of HTTP method. It looks like it takes the first matching route in alphabetical order, because changing "ReadQuestion" to "AReadQuestion" sends all "question" requests to the GET route instead.
When I stop at a breakpoint in the post route, I can see that the Method property on req is correct ("GET"). If I make post request after changing the name of ReadQuestion to AReadQuestion, I can see that req.Method is correct again ("POST").
Side note: The proxy retrieves static files from the blob storage emulator without an issue.
[FunctionName("PostQuestion")]publicstaticasyncTask<HttpResponseMessage>Run([HttpTrigger(AuthorizationLevel.Anonymous,"post",Route="question")]HttpRequestMessagereq,[Queue("newq",Connection="AzureWebJobsStorage")]IAsyncCollector<NewQuestionViewModel>questions,TraceWriterlog){NewQuestionViewModelquestion=null;try{question=awaitreq.Content.ReadAsAsync<NewQuestionViewModel>();}catch(Exceptione){log.Error("Could not post new question.",e);returnreq.CreateErrorResponse(HttpStatusCode.BadRequest,"Could not read question. Please try again.");}awaitquestions.AddAsync(question);returnreq.CreateResponse(HttpStatusCode.Created);}
Yes this is a bug when proxy and function are in the same function app. we will fix this soon. the current workaround is to have your proxies.json and http functions on 2 different function apps.
safihamid
added a commit
to Azure/azure-functions-host
that referenced
this issue
Dec 7, 2017
Hi folks,
Summary
I'm setting up a Functions app to serve static a static site from blob storage, with the api endpoints hosted in the function app. Some of the functions have the same route, but they are configured to handle different HTTP methods.
When I don't include my proxies.json file in my build, I can route to the correct functions (by HTTP method) without an issue.
Once I include proxies.json in the build build, every "question" request goes to the "PostQuestion" Function, regardless of HTTP method. It looks like it takes the first matching route in alphabetical order, because changing "ReadQuestion" to "AReadQuestion" sends all "question" requests to the GET route instead.
When I stop at a breakpoint in the post route, I can see that the Method property on req is correct ("GET"). If I make post request after changing the name of ReadQuestion to AReadQuestion, I can see that req.Method is correct again ("POST").
Side note: The proxy retrieves static files from the blob storage emulator without an issue.
Code Examples
Function/trigger for GET:
Function/trigger for POST:
Proxies:
Environment details
Running in debug mode from VS with Azure Functions CLI 1.0.7 on Windows 10 Pro.
Microsoft Visual Studio Community 2017
Version 15.4.5
VisualStudio.15.Release/15.4.5+27004.2010
Microsoft .NET Framework
Version 4.7.02046
Installed Version: Community
Visual C# 2017 00369-60000-00001-AA565
Azure App Service Tools v3.0.0 15.0.30915.0
Common Azure Tools 1.10
Microsoft Azure Tools 2.9
NuGet Package Manager 4.4.0
Visual Studio Code Debug Adapter Host Package 1.0
WebJobs Tools v1.0.0 15.0.30923.0
The text was updated successfully, but these errors were encountered: