Azure function throws server error when running with a missing id for the Cosmos DB input binding

Tyler Mason 50 Reputation points

I'm currently working through the "Exercise - Read data with input bindings" unit within the "Chain Azure Functions together using input and output bindings" module.

Adding "&id=docs" to the end of the function url returns the expected JSON with the url.

However when I try "&id=missing", which isn't an id in the Cosmos DB, nothing loads. When I check the filesystem logs I see the following error:

[Error] Executed 'Functions.HttpTrigger1' (Failed, Id=8312e932-bcb7-4cb2-b83f-85a10d88021d, Duration=1413ms)Response status code does not indicate success: NotFound (404); Substatus: 0; ActivityId: 72a2e82e-e53a-4d99-a257-2af7400f2733; Reason: (code : NotFoundmessage : Entity with the specified id does not exist in the system. More info:

What I expected to happen is the "&id=missing" url page to have the JSON with "No bookmarks found".

Additional info:

I'm using the Microsoft Learn Sandbox with Node.js.

I'm exclusively using the Azure Portal (Not connected to VS or anything like that).

Module url:




module.exports = function (context, req) {

Attempted solution:

Saw multiple posts suggesting changing the function's runtime version from 4 to 2, but the drop down for that only gives me the option for version 4.

User's image

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,653 questions
Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,539 questions
{count} votes