Azure函数BlobTrigger触发,但未找到Blob

时间:2019-06-07 19:31:10

标签: triggers azure-functions azure-blob-storage azure-durable-functions

我终于用下面的代码重现了这个问题。 我只是使用blob触发器来触发持久函数,并且在其中一个活动函数中读取blob。但是...当我读取blob时,我收到一个错误,该blob不存在。

有人可以在这里解释我在做什么错吗?

代码:

[FunctionName("BlobTrigger")]
public static async void Trigger(
[BlobTrigger("incoming-blob/{filename}", Connection = "")]Stream myBlob,
[OrchestrationClient]DurableOrchestrationClient starter,
string filename,
ILogger log)
{
    var instanceId = await starter.StartNewAsync("Orchestrator", filename);
}

[FunctionName("Orchestrator")]
public static async Task RunOrchestrator(
    [OrchestrationTrigger] DurableOrchestrationContext context)
{
    var filename = context.GetInput<string>();
    await context.CallActivityAsync("Read_Blob", filename);
}

[FunctionName("Read_Blob")]
public static async Task Activity(
    [ActivityTrigger] string filename,
    [Blob("incoming-blob")] CloudBlobContainer container,
    ILogger log)
{
    var stream = new MemoryStream();
    var blob = container.GetBlockBlobReference(filename);
    await blob.DownloadToStreamAsync(stream);
    //EXCEPTION THROWN AT ABOVE LINE.
    stream.Dispose();
}

1 个答案:

答案 0 :(得分:0)

好像您正在使用传入的参数 String getVideoID(String url) { url = url.replaceAll("https://www.youtube.com/watch?v=", ""); url = url.replaceAll("https://m.youtube.com/watch?v=", ""); return url; } 来尝试flutter emulator -- launch <emulator id 而不是container.GetBlockBlobReference("filename")