What Does This Error Mean Invalid Blob Path Specified Blob Identifiers Must be in the Format Container Blob

I am creating an Azure function using Blob trigger, and when I publish this function to the portal and run the function. Son, I am getting this error, what does this mean? I am not able to understand this error:

Here is the code:

using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Google.Apis.Auth.OAuth2;
using Google.Apis.Upload;
using Google.Apis.YouTube.v3.Data;
using System.Reflection;
using Google.Apis.YouTube.v3;
using Google.Apis.Services;
using System.Threading;

namespace UploadVideoBlob
{
    public static class Function1
    {
        [FunctionName("Function1")]
        public static async Task Run([BlobTrigger("video/{name}")]Stream myBlob, string name, Microsoft.Azure.WebJobs.ExecutionContext context, ILogger log)
        {
            UserCredential credential;
            using (var stream = new FileStream(System.IO.Path.Combine(context.FunctionDirectory, "client_secrets.json"), FileMode.Open, FileAccess.Read))
            {
                credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
                    GoogleClientSecrets.Load(stream).Secrets,
                    new[] { YouTubeService.Scope.YoutubeUpload },
                    "user",
                    CancellationToken.None
                );
            }

            var youtubeService = new YouTubeService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName = Assembly.GetExecutingAssembly().GetName().Name
            });

            var video = new Video();
            video.Snippet = new VideoSnippet();
            video.Snippet.Title = "Default Video Title";
            video.Snippet.Description = "Default Video Description";
            video.Snippet.Tags = new string[] { "tag1", "tag2" };
            video.Snippet.CategoryId = "22";
            video.Status = new VideoStatus();
            video.Status.PrivacyStatus = "unlisted";
            var VideoInsertRequest = youtubeService.Videos.Insert(video, "snippet,status", myBlob, "video/*");
            await VideoInsertRequest.UploadAsync();
        }
    }
}

Here is the function.json:

{
  "generatedBy": "Microsoft.NET.Sdk.Functions-1.0.29",
  "configurationSource": "attributes",
  "bindings": [
    {
      "type": "blobTrigger",
      "path": "video/{name}",
      "name": "myBlob"
    }
  ],
  "disabled": false,
  "scriptFile": "../bin/UploadVideoBlob.dll",
  "entryPoint": "UploadVideoBlob.Function1.Run"
}

This Post Has One Comment

  1. No Fault

    Reproduce your error:

    enter image description here

    I find your function. Son don’t have the connection string. Your trigger attribute should be this:

    [BlobTrigger(“video/{name}”, Connection = “str”)]
    And this is your function.json on portal should be like:

    enter image description here

    And you should have the application setting in this place:

    enter image description here

    enter image description here

    The key of the setting is str, and the value of the setting is from this place:

    enter image description here

    Go to your storage account, the connecting string is the value.

    Then it works fine, like this:

    enter image description here

    This is my local.settings.json in VS:

    {
    “IsEncrypted”: false,
    “Values”: {
    “AzureWebJobsStorage”: “DefaultEndpointsProtocol=xxxxxxcore.windows.net”,
    “FUNCTIONS_WORKER_RUNTIME”: “dotnet”,
    “str”: “DefaultEndpointsProtocol=xxxxxxcore.windows.net”
    }
    }
    (Copy the value from your storage account)

    Original Answer:

    when I publish this function to the portal and run the function. Son.

    Off Course. From your operation, the error comes from you didn’t add a real blob to the container. Blob trigger is not like the httptrigger on portal. Actually, httptrigger on portal will create a request, but blob rigger on portal will not create a blob for you. You need to add a real blob to the video container.

Leave a Reply