azure-functions-python-worker: Timer trigger function results in output TypeError

Is your question related to a specific version? If so, please specify:

Version 2

What binding does your question apply to, if any? (e.g. Blob Trigger, Event Hub Binding, etc)

My function has a timer input trigger and a sendgrid output trigger.

Question

Yesterday I added a new function to my Azure function app. Since adding it, an already existing function (with the bindings described above) that I didn’t change anything about doesn’t run correctly anymore because it gives the following error: Result: Failure Exception: TypeError: unable to encode outgoing TypedData: unsupported type “<class ‘azure_functions_worker.bindings.generic.GenericBinding’>” for Python type “NoneType” I see online that this error occurs when your function has an HTTP output binding and you don’t return any HTTPResponse. However, mine doesn’t have any HTTP binding. It’s not supposed to return anything as you create the output by calling the ‘set’ method on the ‘sendGridMessage’ input argument. I already restore the function app back the its previous state by deleting the function that I added yesterday, but the error keeps on happening. Could anyone help me fix this issue please? It might also just be a bug…

Here’s the function.json file content: { "scriptFile": "__init__.py", "bindings": [ { "name": "mytimer", "type": "timerTrigger", "direction": "in", "schedule": "0 0 * * * *" }, { "type": "sendGrid", "name": "sendGridMessage", "direction": "out", "apiKey": "SendGridAPIKey", "from": "..." } ], "retry": { "strategy": "exponentialBackoff", "maxRetryCount": 5, "minimumInterval": "00:00:10", "maximumInterval": "00:15:00" } }

And the relevant parts of my init.py file: def main(mytimer: func.TimerRequest, sendGridMessage: func.Out[str]) -> None: # noqa: F841 message = ... sendGridMessage.set(json.dumps(message)) logging.info('Function ran successfully.')

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 15 (4 by maintainers)

Most upvoted comments

Apologies for this error. We have fixed this issue and are in process of releasing a new runtime version. The fix will be in runtime version 4.33.2

Same here on very different trigger types. What worked for me as a workaround was changing the return type to “-> str” and always return '' instead of a plain return / return None.

@gijs-romme Can you try removing the return None or return just any string for your second function? Would you also be able to share your functionapp name or any previous invocation id?