Skip to content

HttpTrigger not populating binding data from query #2554

Closed
@julielerman

Description

@julielerman

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:

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions