Azure / Azure/azure-functions-durable-python

Worker failed to load Durable Entity function when binding a Storage Queue

Offen
#392 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Enhancement fixed-in-v2 P3
Vorherrschende Sprache
Python
Sterne
157
Forks
70
Ø Merge
2 T. 10 Std.
Gemergte PRs (30 T.)
2

Beschreibung

🐛 **Describe the bug**
> I'm learning about Durable Entities , not sure if this is supported or not. I'm using counter sample provided [here](https://github.com/Azure/azure-functions-durable-python/tree/dev/samples/counter_entity) and trying to bind a Storage Queue . However worker complains about not finding the corresponding parameter:
```
[2022-07-22T15:02:30.124Z] Worker failed to load function: 'Counter' with function id: 'a80f6d9c-8814-4549-bc62-155546eaf880'.
[2022-07-22T15:02:30.125Z] Result: Failure
Exception: FunctionLoadError: cannot load the Counter function: the following parameters are declared in function.json but not in Python: {'outputQueueItem'}
```

🤔 **Expected behavior**
> What should have happened?
Worker is able to load Function

☕ **Steps to reproduce**
> What Durable Functions patterns are you using, if any?
HTTPTrigger > Orchestration > Entity

> Any minimal reproducer we can use?
https://github.com/enriqueayala/azure-function-counter.git

**_ _init.py_ _**
```
import logging
import json

import azure.functions as func
import azure.durable_functions as df

def entity_function(context: df.DurableEntityContext, outputQueueItem: func.Out[str]):
"""A Counter Durable Entity.
A simple example of a Durable Entity that implements
a simple counter.
Parameters
----------
context (df.DurableEntityContext):
The Durable Entity context, which exports an API
for implementing durable entities.
"""

current_value = context.get_state(lambda: 0)
operation = context.operation_name
if operation == "add":
amount = context.get_input()
current_value += amount
elif operation == "reset":
current_value = 0
elif operation == "get":
pass

context.set_state(current_value)
context.set_result(current_value)
outputQueueItem.set(current_value)

main = df.Entity.create(entity_function)
```
**function.json**
```
{
"scriptFile": "__init__.py",
"bindings": [
{
"name": "context",
"type": "entityTrigger",
"direction": "in"
},
{
"type": "queue",
"direction": "out",
"name": "outputQueueItem",
"queueName": "outqueue",
"connection": "AzureWebJobsStorage"
}
]
}

```

> Are you running this locally or on Azure?
Locally

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginnen Sie mit der __init__.py und function.json des reproduzierten Counter-Beispiels. Verfolgen Sie anschließend, wie der Einstiegspunkt entity_function geladen wird und wie seine outputQueueItem-Bindung validiert wird. Führen Sie den lokalen Reproducer aus und vergleichen Sie das Laden der Funktion mit vorhandener Queue-Bindung. Als abgeschlossen gilt die Aufgabe, wenn die Counter-Funktion mit der deklarierten Storage Queue-Ausgabe erfolgreich geladen wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
backend
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.