Azure Durable Function Activity. 'Finalout' failed: FunctionLoadError: cannot load the Finalout function: binding payload has invalid non-type annotation list[str]

polishteapot 0 Reputation points
2023-11-30T03:06:13.6466667+00:00

list[str] is a canonical type annotation in python 3.11 but Azure Functions is rejecting it with an error in an activity. Where can I find a complete list of type annotations that are valid and acceptable to use in a parameter list for an activity?

2023-11-30T02:44:26Z [Error] 66f4a748af294015bf753f63840015ae: Function 'wfrqyOrchestrator (Orchestrator)' failed with an error. Reason: Message: Activity function 'Finalout' failed: FunctionLoadError: cannot load the Finalout function: binding payload has invalid non-type annotation list[str] {"$type":"System.Exception, System.Private.CoreLib","ClassName":"System.Exception","Message":" FunctionLoadError: cannot load the Finalout function: binding payload has invalid non-type annotation list[str]","Data":null,"InnerException":{"$type":"Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException, Microsoft.Azure.WebJobs.Script","IsUserException":false,"RemoteStackTrace":" File "/azure-functions-host/workers/python/3.11/LINUX/X64/azure_functions_worker/dispatcher.py", line 393, in _handle__function_load_request\n self._functions.add_function(\n File "/azure-functions-host/workers/python/3.11/LINUX/X64/azure_functions_worker/functions.py", line 338, in add_function\n input_types, output_types = self.validate_function_params(params,\n

The activity is in python :

import asyncio
import azure.functions as func
async def main( payload: list[str] , outputblob: func.Out[str] ) -> str:
    outputblob.set( payload[0] + payload[1] ) 
    return("Finalout")

Corresponding function.json :

{
  "scriptFile": "__init__.py",
  "bindings": [
    {
      "name": "payload",
      "type": "activityTrigger",
      "direction": "in"
    },
    {
      "name": "outputblob",
      "type": "blob",
      "dataType": "string",
      "path": "books/testout.json",
      "connection": "BlobStorageConnection",
      "direction": "out"
    }
  ],
  "disabled": false 
}


Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,930 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MuthuKumaranMurugaachari-MSFT 22,441 Reputation points Moderator
    2023-11-30T16:43:36.2733333+00:00

    polishteapot Thanks for reaching out to Microsoft Q&A. I am able to repro this issue at my end with Python 3.11 however it works fine with 3.10.

    To answer your first question, check Trigger Usage doc for activity trigger and both input and output must be JSON-serializable. If it is, then should be supported.

    I have opened a new issue https://github.com/Azure/azure-functions-durable-python/issues/468 with durable function and already reached out to the product team internally to investigate further. Please follow the issue for more updates and will also post it here.

    I hope this helps and let me know if any questions.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.