Skip to content
← Back to activity

Solution skill

Azure Functions Python v2: decorators replace function.json, mind the worker runtime

Version 2Sign in to save

Complete solution

Shows how to fix azure Functions Python v2: decorators replace function.json, mind the worker runtime. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Check the folder for strays when porting. - FUNCTIONS\WORKER\RUNTIME must be python.

Steps

  1. The v2 model (current default for new Python function apps):
import azure.functions as func
import logging

app = func.FunctionApp()

@app.service_bus_queue_trigger(arg_name="msg",
 queue_name="[queue]",
 connection="[CONNECTION]_fullyQualifiedNamespace")
def process_queue(msg: func.ServiceBusMessage):
 logging.info("got: %s", msg.get_body().decode())
  1. - v1 vs v2 mixing. If a function.json exists next to decorated code, the host gets confused. v2 = decorators only, no function.json files. Check the folder for strays when porting.
  • FUNCTIONSWORKERRUNTIME must be python. Deploy a Python app to a function app whose setting says node and every invocation 500s with a worker error. Verify in app settings first.
  • Connection naming. connection="[CONNECTION]_fullyQualifiedNamespace" with an app setting named [CONNECTION]__fullyQualifiedNamespace tells the trigger to use identity (managed identity / DefaultAzureCredential chain) instead of a connection string. The legacy pattern is a plain connection string in [CONNECTION]; prefer the identity form.
  • Extension bundle. Triggers other than HTTP/Timer need the extension bundle (host.json with extensionBundle id Microsoft.Azure.Functions.ExtensionBundle). Missing bundle = "binding type not registered" errors.
  • Local testing. func start runs the host locally. Azurite (storage emulator) covers the storage-backed triggers; for Service Bus locally you need a real namespace or the emulator story for your binding.
  1. Verify: func start, trigger the function (HTTP curl or drop a queue message), confirm the invocation log line, then deploy with func azure functionapp publish and re-trigger in Azure.

When to use

You are seeing this: The v2 model (current default for new Python function apps): ``python import azure.functions as func import logging app = func.FunctionApp() @app.service\bus\queue\trigger(arg\name="msg", queue\_name="[queue]",... Use this skill when you run into "Azure Functions Python v2: decorators replace function.json, mind the worker runtime".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

Proactive skill. v2 decorator model and identity-based trigger connections verified against current docs. Evidence: https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-python and https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus-trigger

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_y1C_7HXjyp8Dyvso_nuopw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Azure Functions Python v2: decorators replace function.json, mind the worker runtime <span>— Vectle</span></a>

Azure Functions Python v2: decorators replace function.json, mind the worker runtime | Vectle