Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Custom object serialization broken for orchestrator return values

Abierto Apto para principiantes
#568 1 comentario 0 reacciones 0 asignados Ver en GitHub

@andystaples ya está trabajando en esto.

Desde el 31/7/2026.

  • #569 de @hoesler — cerrado sin fusionar
  • #620 de @andystaples — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
75/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Tranquilo
Stack tecnológico
python
Área
backend

Línea de trabajo

Comienza en azure/durable_functions/models/TaskOrchestrationExecutor.py, en TaskOrchestrationExecutor.get_orchestrator_state_str(), y compara su serialización JSON con los otros modelos o entidades mencionados en el issue. Reproduce la orquestación usando el ejemplo de CustomResult y verifica que se pueda devolver un objeto con to_json() sin que se produzca el error not-serializable.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug fixed-in-v2 P2

🐛 Describe the bug
Azure Durable Functions Python SDK fails to serialize custom objects that implement a to_json() method when returning from orchestrator functions. The error "Object of type [CustomClass] is not JSON serializable" is raised.

🤔 Expected behavior
Custom objects implementing a to_json() method should be automatically serialized when returned from orchestrator functions.

☕ Steps to reproduce
Basic orchestration with custom return types.

  1. Create a custom class with to_json() and from_json() methods:
from dataclasses import dataclass

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

app = df.DFApp(http_auth_level=func.AuthLevel.ANONYMOUS)

@dataclass
class CustomResult():
  message: str
  success: bool = True

  def to_json(self):
      return {"message": self.message, "success": self.success}

  @classmethod
  def from_json(cls, data):
      return cls(message=data["message"], success=data["success"])

@app.orchestration_trigger(context_name="context")
def orchestrator_function(context: df.DurableOrchestrationContext):
  return CustomResult(message="Hello from orchestrator!", success=True)

@app.route(route="test", methods=["GET"])
@app.durable_client_input(client_name="client")
async def http_start_conversion(req: func.HttpRequest, client: df.DurableOrchestrationClient) -> func.HttpResponse:
  instance_id = await client.start_new(
      orchestration_function_name="orchestrator_function"
  )

  return client.create_check_status_response(req, instance_id)

  1. Execute the orchestration - it will fail with "Object of type CustomResult is not JSON serializable"

Environment: Running locally with
Azure Functions Core Tools Version: 4.1.0
azure-functions-durable: 1.3.2

Root cause: In TaskOrchestrationExecutor.get_orchestrator_state_str(), the code calls dumps without a default argument:
https://github.com/Azure/azure-functions-durable-python/blob/15ed958555b9410629f97cd7884d8783cb0e460e/azure/durable_functions/models/TaskOrchestrationExecutor.py#L284

But should call:
json.dumps(self._data, default=_serialize_custom_object) as in other models or entities.

⚡If deployed to Azure
Didn't test yet. Since the bug is in the Python SDK code itself, I expect the same issue to occur.

Lenguaje dominante
Python
Estrellas
157
Forks
70
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Azure/azure-functions-durable-python

Todos los issues de Azure/azure-functions-durable-python

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.