Azure / azure-functions-powershell-worker

PowerShell language worker for Azure Functions.
MIT License
206 stars 53 forks source link

Pushing output to AppendBlob #674

Open thielj opened 3 years ago

thielj commented 3 years ago

I'm trying to push data to an append blob, but keep getting the same error: "Cannot bind to page or append blobs using 'out string', 'TextWriter', or writable 'Stream' parameters."

My understanding is that this has been implemented in Azure WebJobs SDK (#865, #859); that the SDK locates and correctly identifies the blob type as "AppendBlob"; and that the error is thrown from WriteBlobArgumentBinding.cs. The error message seems to be specific to C# bindings.

What I can't figure out is what type is expected here in Powershell - neither a stringor byte[] seems to work? Is this even supported in the Powershell worker?


To reproduce:

(1) create an empty append blob, e.g. az storage blob upload <...> --type append

(2) function.json:

{
  "bindings": [
    {
      "name": "workItem",
      "type": "queueTrigger",
      "direction": "in",
      "queueName": "append-to-blob",
      "connection": "MY_STORAGE"
    },
    {
      "name": "receipt",
      "type": "blob",
      "direction": "out",
      "path": "folder/myblob.dat",
      "connection": "MY_STORAGE"
    }
  ]
}

(3) Run.ps1:

param([string] $workItem, $TriggerMetadata)
Write-Host "PowerShell queue trigger function processed work item: $workItem"
Push-OutputBinding -Name 'receipt' -Value $workItem

(4) Log stream output:

[Information] Executing 'Functions.AppendToBlob' (Reason='New queue message detected on 'append-to-blob'.', Id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
[Information] INFORMATION: PowerShell queue trigger function processed work item: Hello, World!
[Error] Executed 'Functions.AppendToBlob' (Failed, Id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, Duration=62ms)Cannot bind to page or append blobs using 'out string', 'TextWriter', or writable 'Stream' parameters.
Francisco-Gamino commented 3 years ago

First check if this is PowerShell specific.