Skip to content

Writing multiple messages to a single queue #192

@asavaritayal

Description

@asavaritayal

I tried the following function -

import azure.functions as func

def main(req: func.HttpRequest,
         msg: func.Out[func.QueueMessage]) -> str:

    messages = ("apple", "banana", "cherry")

    msg.set(messages)

    return ""
{
  "scriptFile": "__init__.py",
  "bindings": [
    {
      "name": "req",
      "direction": "in",
      "type": "httpTrigger",
      "authLevel": "anonymous"
    },
    {
      "name": "msg",
      "direction": "out",
      "type": "queue",
      "queueName": "outqueue",
      "connection": "AzureWebJobsStorage"
    },
    {
      "name": "$return",
      "direction": "out",
      "type": "http"
    }
  ]
}

Received the error below -

[9/8/18 12:35:37 AM] Executing 'Functions.Outputs' (Reason='This function was programmatically called via the host APIs.', Id=d487ce2b-7d34-43e7-958c-32fdcbd2110c)
[9/8/18 12:35:37 AM] Executed 'Functions.Outputs' (Failed, Id=d487ce2b-7d34-43e7-958c-32fdcbd2110c)
[9/8/18 12:35:37 AM] System.Private.CoreLib: Exception while executing function: Functions.Outputs. System.Private.CoreLib: Result: Failure
[9/8/18 12:35:37 AM] Exception: TypeError: unable to encode outgoing TypedData: unsupported type "queue" for Python type "tuple"
[9/8/18 12:35:37 AM] Stack:   File "/Users/asavaritayal/python_docs_testing/env1/lib/python3.6/site-packages/azure/functions_worker/dispatcher.py", line 282, in _handle__invocation_request
[9/8/18 12:35:37 AM]     pytype=out_type_info.pytype)
[9/8/18 12:35:37 AM]   File "/Users/asavaritayal/python_docs_testing/env1/lib/python3.6/site-packages/azure/functions_worker/bindings/meta.py", line 286, in to_outgoing_proto
[9/8/18 12:35:37 AM]     f'unable to encode outgoing TypedData: '
[9/8/18 12:35:37 AM] .

I thought we were supporting multiple outputs via a tuple. Any idea what's wrong? @1st1 @elprans

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions