2

I followed the Microsoft how-to to create a function that triggers when a file is added to a specific blob storage container. I have completed the how-to, and repeated it in case I did something wrong, but no log showed up when I added a file to the container manually. So I found this question:

Azure function apps logs not showing

but nothing suggested there showed logs either. I then found I should use the built in run/test feature in the portal, and it gave me the error:

2020-11-25T03:11:04.271 [Error] Executed 'Functions.BlobTrigger1' (Failed, Id=407e0495-dd12-4e7a-be74-fa1e33ff7368, Duration=8ms)The specified container does not exist.

I have looked at forum posts addressing this problem, and I can't find anything or how to apply it to this simple function. The function code is as follows.

run.csx:

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

function.json:

{
  "bindings": [
    {
      "name": "myBlob",
      "type": "blobTrigger",
      "direction": "in",
      "path": "samples-workitems/{name}",
      "connection": "AzureWebJobsStorage"
    }
  ]
}

Other answers are also quite old and so the portal set up is different and I can't find some things suggest. I am also using an educational account if that helps. Thanks in advance for any advice.

1 Answers1

1

The function.json you provided is correct, I think your code is also correct because the function is very simple. The blob trigger can be triggered by upload a blob to storage container success, but if we click Test/Run button on azure portal to trigger the blob trigger, is will show the error message as you mentioned The specified container does not exist.. This is normal, it doesn't mean there's a problem with your code.

So I think the problem is the log. Sometimes the log can't be print in log window in real time. But we can see it in log file according Kudu which the post you provided mentioned. If still can't see the log, you can try to check the log in "Monitor" tab.

enter image description here

By the way, logs in "Monitor" tab may be five minutes delay.

=================================Update==============================

Since you can't see log in kudu log file, the other case is you didn't trigger the function success. Please check if you successfully update the blob to the specified container.

Hury Shen
  • 14,948
  • 1
  • 9
  • 18
  • Thank you so much! I was so sure that since it gave me an error in testing that it couldn't be working, so I was focused on fixing that. But after a long wait I did get a success in the monitor. I'm still confused as to how the testing comes up with an error though, it seems like a pretty useless function if it can't handle basic tutorial code. Would it work with an expensive account that pays to reduce the latency? – funny_reference_to_something Nov 25 '20 at 05:00
  • Hi @funny_reference_to_something You mean change with a more expensive to reduce the delay of log ? As far as I know, it has nothing to do with pricing tier. – Hury Shen Nov 25 '20 at 05:26
  • Oh I must have misread something about that. Anyways I'm happy as long as it works. – funny_reference_to_something Nov 25 '20 at 07:37