Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

CosmosDB Outputbinding does not work for multiple documents

Open
#109 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
java
Domain
databases

Research direction

Start by reproducing the Java function with EventHubTrigger Cardinality.MANY and CosmosDBOutput using OutputBinding<List>. Trace how the Java CosmosDB output binding handles outputDocument.setValue(messages), and compare its behavior with the documented .NET and JavaScript support. Done means identifying whether multiple documents are supported in Java and recording or correcting the resulting behavior.

Written by the indexing model from the issue text.

Description

area:java-functions

We have a simple function which is triggered by event hub and simply forwards messages to cosmosDB using the cosmosDB output binding.
It works well if we receive and forward one message.
However it does not work when we receive and forward a list of messages using Cardinality.many.
Example:

public void run(
	@EventHubTrigger(
			name = "ConsumeDeviceMessages2",
			eventHubName = "@eventhub.name@",
			connection = "@iothub.connection@",
			consumerGroup = CONSUMER_GROUP,
			cardinality = Cardinality.MANY)
			List<String> messages,

	@CosmosDBOutput(
			name = "outputDocument",
			databaseName = "@cosmosdb.name@",
			collectionName = "@cosmosdb.collection.name@",
			connectionStringSetting = "@cosmosdb.connection.appsetting@")
			OutputBinding<List<String>> outputDocument,

	final ExecutionContext context) {
	outputDocument.setValue(messages);
}

If this is triggered an error occurs:

[Error] Executed 'Functions.SaveIotDeviceMessages' (Failed, Id=a845d74b-861a-40e7-a6f2-f5b7032b2cf2)Value cannot be null.Parameter name: document

Configuration seems pretty basic and works on another function where we forward multiple messages to a queue instead.

Any idea why it is not working for cosmosDB? The documentation states its working for .NET and Javascript, no information about Java though.

Thanks and regards.

Dominant language
Java
Stars
45
Forks
49
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Azure/azure-functions-java-library

All issues in Azure/azure-functions-java-library

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.