azure-functions-core-tools: Generated function.json missing direction out
Problem
I am attempting to deploy an Azure Function via Rider. The function is triggered by an IoT Hub message, parses the data into json, and writes it to a Cosmos database.
When deploying this function, the generated function.json
is missing the out direction on the generated Cosmos bindings. Everything else is correct.
Below is the C# code and bindings section of function.json
with sensitive data replaced with placeholder values.
C# Code:
using Newtonsoft.Json.Linq;
using IoTHubTrigger = Microsoft.Azure.WebJobs.EventHubTriggerAttribute;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
public static class IoTHubToCosmosDB
{
[FunctionName("IoTHubToCosmosDB")]
public static void Run(
[IoTHubTrigger("eventHubName", Connection = "connectionString", ConsumerGroup = "consumerGroup")] string myIoTHubMessage,
[CosmosDB("databaseName", "collectionName", ConnectionStringSetting = "connectionString", CreateIfNotExists = true, PartitionKey = "/deviceId")] out object dataDocument,
ILogger log)
{
log.LogInformation($"C# trigger Azure function processed a IoT Hub message: {myIoTHubMessage}");
var parsedMessage = JObject.Parse(myIoTHubMessage);
dataDocument = parsedMessage;
}
}
Bindings from generated function.json:
"bindings": [
{
"type": "eventHubTrigger",
"connection": "connectionString",
"consumerGroup": "consumerGroup",
"eventHubName": "eventHubName",
"name": "myIoTHubMessage"
},
{
"type": "cosmosDB",
"connectionStringSetting": "connectionString",
"createIfNotExists": true,
"partitionKey": "/deviceId",
"databaseName": "databaseName",
"collectionName": "collectionName",
"useMultipleWriteLocations": false,
"useDefaultJsonSerialization": false,
"name": "dataDocument"
}
],
Environment Azure Toolkit for Rider 3.50.0.1314-2021.3 Azure Functions Core Tools 4.0.4785 JetBrains Rider 2021.3.4
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 18 (7 by maintainers)
For what it’s worth, on our end it appears the lack of the
out
attribute is not actually breaking the function. We thought it was. It does break the Portal UI though which shows the Integration and how the bindings are configured on the function.