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.

HttpTrigger not populating binding data from query

See original GitHub issue

Using v1, I have a function app that uses a route on the HTTP trigger and an id parameter for a CosmosDB input binding.

Here is the function.json for that function:

 "bindings": [
    {
      "authLevel": "anonymous",
      "name": "req",
      "type": "httpTrigger",
      "direction": "in",
      "route": "document/{documentId}"
    },
    {
      "name": "$return",
      "type": "http",
      "direction": "out"
    },
    {
      "type": "documentDB",
      "name": "document",
      "databaseName": "CookieBinge",
      "collectionName": "Binges",
      "connection": "datapointscosmosdb_DOCUMENTDB",
      "direction": "in",
      "id": "{documentId}"
    }
  ],
  "disabled": false
}

My app outputs one of the values from the incoming document. This app is written in C#. I can use the test feature to pass in a document id and it runs successfully. image

I’m building a new function using v2. The binding uses v2 settings.

{
  "type": "cosmosDB",
  "name": "document",
  "databaseName": "Ninjas",
  "collectionName": "Ninjas",
  "connectionStringSetting": "datapointscosmosdb",
  "direction": "in",
   "id": "{documentId}"
}

It fails with internal server errors if I try to test on the portal. error: One or more errors occurred. (Worker process with pid 6236 exited with code 1) (Worker process with pid 4316 exited with code 1) (Worker process with pid 4728 exited with code 1) When debugging in VS Code using the extension, the incoming bound document is not a single document but it is all of the docs in the collection. I can see the documentId value in the context.bindingData. I’ve been banging on this problem for a while and thought that maybe I’ve just hit a bug and it’s not me. 😃

Investigative information

Please provide the following:

  • Timestamp: ??? Don’t know how to see this from context in vs code
  • Function App version (1.0 or 2.0-beta): 2.0-beta
  • Function App name: NinjaFunctions2
  • Function name(s) (as appropriate):
  • Invocation ID: “1273ffff-ac34-4e99-a2b3-f82b4b6a0194”
  • Region:

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:30 (25 by maintainers)

github_iconTop GitHub Comments

1reaction
brettsamcommented, May 25, 2018

Agree. We’ll need to fix it.

For a little background – SqlQuery (and Table’s query) has custom logic for preparing the query payload (https://github.com/Azure/azure-webjobs-sdk-extensions/blob/dev/src/WebJobs.Extensions.CosmosDB/CosmosDBSqlResolutionPolicy.cs), and it wasn’t designed for nested properties. The context we’re given doesn’t have enough information for us to build up the SQL query in the way we need to.

1reaction
fabiocavcommented, Apr 19, 2018

That’s correct. This is a V2 regression that must be addressed. I think this can be done this sprint, so I’m updating the milestone.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't get query parameter from HttpRequestData
NET 5.0, we use the HttpRequestData in Http Trigger. The class does not contain Query parameter. For more details, please refer to here ......
Read more >
Azure Functions HTTP trigger
In this article ... The HTTP trigger lets you invoke a function with an HTTP request. You can use an HTTP trigger to...
Read more >
Different Ways to Parse Http Request Data in Http-triggered ...
Query and specify the key you are looking for, in this example “id”. If there is no value in the incoming request, id...
Read more >
Azure Function - HTTP POST Input with SQL binding
I'm working on a Javascript Azure Function, triggered by an HTTP POST request, and bound to an Azure SQL server. The function needs...
Read more >
Azure Functions HTTP Trigger - YouTube
0:00 Intro 1:19 Demo 13:32 Conclusion Azure Functions University - https://github.com/marcduiker/azure-functions-university - Follow Marc ...
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