Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

[BUG] Plotly Cloud devtool route crashes with FastAPI and Quart backends

Ouverte
#4,008 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
65/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
fastapi, flask, python
Domaine
backend, devtools

Piste de recherche

The issue is in plotly_cloud/_devtool_hooks.py line 36 where flask.request.get_json() is called. First, understand how Dash registers routes for different backends (FastAPI, Quart, Flask). Look at the Dash server initialization and route registration logic. Check if the devtool route should be conditionally registered based on the backend. The fix likely involves checking the request context or using backend-agnostic request data access. Run the provided reproduction script to confirm the crash.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Describe your context
  • OS: Linux on WSL2
  • Python: 3.13.11
  • Browser: N/A (server-side issue reproduced with backend test clients)
Dash 4.5.0rc0 / FastAPI environment:
dash          4.5.0rc0
plotly-cloud  0.5.0
fastapi       0.141.1

Dash 4.5.0rc0 / Quart environment (isolated):
dash          4.5.0rc0
plotly-cloud  0.5.0
quart         0.23.1
Describe the bug

With the FastAPI or Quart backend, the Plotly Cloud devtool registers POST /_plotly_cloud_publish, but its handler calls flask.request.get_json(). Neither backend provides a Flask request context, so this route returns HTTP 500:

File "plotly_cloud/_devtool_hooks.py", line 36, in plotly_cloud_publish_rpc
    data = flask.request.get_json()
RuntimeError: Working outside of request context.

This is exposed by default in Dash 4.5.0rc0 because #3947 made plotly-cloud a default dependency. To distinguish the dependency change from the underlying compatibility issue, I tested isolated environments:

Environment Cloud route registered? POST result
Dash 4.4.1, without Plotly Cloud No N/A
Dash 4.4.1 + Plotly Cloud 0.5.0 Yes 500 (FastAPI and Quart)
Dash 4.5.0rc0, without explicitly installing Plotly Cloud Yes 500 (FastAPI and Quart)
Steps to reproduce

Install dash[fastapi,quart]==4.5.0rc0 and httpx, then run the following script in separate processes with fastapi and quart as the argument:

import asyncio
import sys

from dash import Dash, html
from fastapi.testclient import TestClient

backend = sys.argv[1]
app = Dash(__name__, backend=backend)
app.layout = html.Div("Hello")
app.enable_dev_tools(debug=True, dev_tools_ui=True)

if backend == "fastapi":
    response = TestClient(
        app.server, raise_server_exceptions=False
    ).post("/_plotly_cloud_publish", json={})
else:
    response = asyncio.run(
        app.server.test_client().post("/_plotly_cloud_publish", json={})
    )

print(response.status_code)  # 500 for both backends
Expected behavior

Enabling Dash Dev Tools with FastAPI or Quart should not register a Plotly Cloud route that crashes. The integration should support these backends or omit its devtool and route when they are unsupported.

Screenshots

Not applicable; this is a server-side error.

Langage dominant
Python
Étoiles
24.4k
Forks
2.3k
Merge moyen
1 j 19 h
PR mergées (30 j)
19

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de plotly/dash

Toutes les issues de plotly/dash

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.