Skip to content

TypeError: HistoryEvent.__init__() missing 4 positional arguments error occurs if app uses WebPubSub extension #415

@hossam-nasr

Description

@hossam-nasr

There is a bug that sometimes occurs in which running any orchestrator in a DF node app will fail with an error saying "Exception: TypeError: HistoryEvent.init() missing 4 required positional arguments: 'EventType', 'EventId', 'IsPlayed', and 'Timestamp'" as below:

TypeError: HistoryEvent.__init__() missing 4 required positional arguments: 'EventType', 'EventId', 'IsPlayed', and 'Timestamp'
Stack:   File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.10\WINDOWS\X64\azure_functions_worker\dispatcher.py", line 458, in _handle__invocation_request
    call_result = await self._loop.run_in_executor(
  File "C:\Python310\lib\concurrent\futures\thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.10\WINDOWS\X64\azure_functions_worker\dispatcher.py", line 701, in _run_sync_func
    return ExtensionManager.get_sync_invocation_wrapper(context,
  File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.10\WINDOWS\X64\azure_functions_worker\extension.py", line 215, in _raw_invocation_wrapper      
    result = function(**args)
  File "C:\Users\hossamnasr\ms\azure\test-functions\pystein-durable\.venv\lib\site-packages\azure\durable_functions\orchestrator.py", line 69, in handle
    return Orchestrator(fn).handle(DurableOrchestrationContext.from_json(context_body))
  File "C:\Users\hossamnasr\ms\azure\test-functions\pystein-durable\.venv\lib\site-packages\azure\durable_functions\models\DurableOrchestrationContext.py", line 98, in from_json
    return cls(**json_dict)
  File "C:\Users\hossamnasr\ms\azure\test-functions\pystein-durable\.venv\lib\site-packages\azure\durable_functions\models\DurableOrchestrationContext.py", line 50, in __init__
    self._histories: List[HistoryEvent] = [HistoryEvent(**he) for he in history]       
  File "C:\Users\hossamnasr\ms\azure\test-functions\pystein-durable\.venv\lib\site-packages\azure\durable_functions\models\DurableOrchestrationContext.py", line 50, in <listcomp>
    self._histories: List[HistoryEvent] = [HistoryEvent(**he) for he in history]       
)

This occurs when:

  1. Using DF with the upcoming V2 programming model model (not yet public preview)
  2. Setting the EnableWorkerIndexing feature flag
  3. Adding the Microsoft.Azure.WebJobs.Extensions.WebPubSub extension to your .csproj file
  4. Using the WebPubSub extension in your application

See this larger issue for more details: Azure/azure-functions-durable-extension#2338

Metadata

Metadata

Assignees

Labels

P2Priority 2bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions