1
votes

I am new to Azure and tried my hands on azure blob storage trigger function.

I have created a function:

public static void Run(Stream myBlob, string name, Stream outputBlob, ILogger log)
{    log.LogInformation($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes");
}

function.json file:

{
  "bindings": [
    {
      "name": "myBlob",
      "type": "blobTrigger",
      "direction": "in",
      "path": "hunaincontainer/{blobname}.{blobextension}.",
      "connection": "hunainfunctionstorage1_STORAGE"
    }, 
    {
      "type": "blob",
      "name": "outputBlob",
      "path": "hunaincontainer/{blobname}-ResizedImage.{blobextension}",
      "connection": "hunainfunctionstorage1_STORAGE",
      "direction": "out"
    }
  ],
  "disabled": false
}

hunaincontainer is a blob storage container in general purpose storage account. I am using free Azure for testing.

I run the function and it compiles successfully and then I upload an image to hunaincontainer using portal but it doesn't hit the function. Why? The connectionstring, key value and everything is set.

1
As Marie said, clear the dot in the path and wait several minutes and it will work well. Maybe it has some delay. I test in my site with your code and it works.Joey Cai
for me it doesn't... not even nowazure boy

1 Answers

2
votes

I think your issue is a stray period in the path you're setting! Instead of "path": "hunaincontainer/{blobname}.{blobextension}.", try "path": "hunaincontainer/{blobname}.{blobextension}"