JetBrains / azure-tools-for-intellij

Azure Toolkit for JetBrains Rider.
MIT License
48 stars 10 forks source link

Generated function.json missing direction out #631

Closed AllyssaLBatten closed 2 years ago

AllyssaLBatten commented 2 years ago

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

maartenba commented 2 years ago

Hi @AllyssaLBatten Unfortunately this output is not under our control and generated by the Azure Functions SDK. Would you mind opening this issue at https://github.com/Azure/azure-functions-core-tools instead? Thank you 🙏

AllyssaLBatten commented 2 years ago

Hi @AllyssaLBatten Unfortunately this output is not under our control and generated by the Azure Functions SDK. Would you mind opening this issue at https://github.com/Azure/azure-functions-core-tools instead? Thank you 🙏

Will do! Thank you for the suggestion