1

Currently on one of my project, I've an Azure function (NodeJS 16) running to be triggered on a blob creation and that need to take few informations and saved them to a cosmos db. For that I use a Cosmos DB output binding.

At the start, I used the classic connection for that with the connection string. It worked well. But now, I don't want to deal with the rotation of the keys for this connection string. That's why I wanted to move to the version 4+ of the azure extension in order to connect with Managed System Identity.

Right now it works well for the blob trigger with MSI, it is triggered and it run the function. But at the end, when I do the context.done() in order to save the datas to the cosmos db, I get this error.


2022-10-31T15:59:00.203 \[Error\] Executed 'Functions.SaveToCosmosDB' (Failed, Id=9162f53b-8c79-44bf-82b9-ca9c4267cc76, Duration=359ms)

Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified

I'm stuck with it since fews days. I don't get it, why do I get a .NET package error ? I'm using a NodeJS function. Do someone already get this issue before ? Or am I wrong with my configuration ?

Thanks in advance for your help

Here is my host.json:

{
    "version": "2.0",
    "extensionBundle":
    {
        "id": "Microsoft.Azure.Functions.ExtensionBundle.Preview",
        "version": "[4.*, 5.0.0)"
    }
}

and here is my function.json

{
  "bindings": [
    {
      "name": "imageBlob",
      "type": "blobTrigger",
      "direction": "in",
      "path": "images/{name}.bmp",
      "connection": "MYAPP_BLOB"
    },
    {
      "direction": "out",
      "name": "metadata",
      "type": "cosmosDB",
      "databaseName": "MYAPP_COSMOS_DATABASE",
      "containerName": "MYAPP_COSMOS_CONTAINER",
      "connection": "MYAPP_COSMOS",
      "preferredLocations": "Central US"
    }
  ]
}

When I change from extension version 3+ to 4+, I change the property collectionName to containerName as described in the MS documentation https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-cosmosdb-v2-output?tabs=in-process%2Cextensionv4&pivots=programming-language-javascript

But I've seen a mismatch in the documentation, for the .Net version, if we use a 4+ version of the extension, the property ConnectionStringSetting change for Connection but for the JS version of the code, it remains ConnectionStringSetting. Is it normal or is it a typos mistake in the documentation ?

Thanks in advance for your help.

Fawkes
  • 401
  • 1
  • 8
  • 20
  • In your host.json, there seems brackets issue. `"version": "[4.*, 5.0.0)"` may be it should be `"version": "[4.*, 5.0.0]"` – Fawkes Nov 04 '22 at 10:02
  • Yes, `connectionStringSetting` is a typo, it should be `connection`. Your issue sounds like https://github.com/Azure/azure-webjobs-sdk-extensions/issues/750 – Matias Quaranta Nov 04 '22 at 13:48
  • @Fawkes Thanks for your reply, I noticed it also but seems to be good following the document.. https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-register – Laurent Freyss Nov 07 '22 at 09:56
  • @MatiasQuaranta Thanks for your reply, I already had check this issue but what I don't get about it is that I use a .NodeJS Azure function, not a .NET one. So I suppose I don't have this issue on .net 6 :/ – Laurent Freyss Nov 07 '22 at 09:57
  • I am no expert on NodeJS functions, but the error seems to come from .NET and matches what was mentioned on the Issue. It might be related to the Functions runtime? Are you using V4 runtime? – Matias Quaranta Nov 07 '22 at 14:34
  • @MatiasQuaranta yes I'm using V4 runtime – Laurent Freyss Nov 09 '22 at 08:31
  • But how am I supposed to update a .NET nuget package if my azure function is in NodeJS? :/ – Laurent Freyss Nov 09 '22 at 15:08

0 Answers0