[BUG] Plotly Cloud devtool route crashes with FastAPI and Quart backends
Mantenedores costumam responder em até 2 dias
@T4rk1n já está trabalhando nisso.
Desde 24/9/2026.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 65/100
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Python
- Estrelas
- 24.4k
- Forks
- 2.3k
- Merge médio
- 2d 19h
- PRs com merge (30d)
- 26
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de plotly/dash
-
P2 plotly-internal size: 1 task
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 2 dias
-
Extract graph schema validation into properly named testTalvez já em andamento @Nice6042 assumiu há 61 dias. Abertagood first issue P3 size: 1 task
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
plotly/dash#3735 · 3 comentários ·
Mantenedores costumam responder em até 2 dias
-
[BUG] dcc.Dropdown: hidden focus-target input is focusable inside aria-hidden and can overflow its wrapperTalvez já em andamento @KoolADE85 assumiu há 8 dias. Abertabug P2 size: 1
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 56/100
plotly/dash#4042 · 3 comentários · 1 responsável ·
Mantenedores costumam responder em até 2 dias
-
P3 plotly-internal size: 10+ task
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 30/100
plotly/dash#4040 · 3 comentários ·
Mantenedores costumam responder em até 2 dias
-
Drop Python 3.9 SupportAbertaP2 plotly-internal size: 5 task
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
plotly/dash#4038 · 2 comentários ·
Mantenedores costumam responder em até 2 dias
Todas as issues de plotly/dash
Issues semelhantes
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
Deltares/imod-python#1940 ·
Mantenedores costumam responder em até 1 dia
-
effort: low prio: low ready
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 82/100
digitalfabrik/integreat-cms#4621 ·
Mantenedores costumam responder em até 5 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
ioos/compliance-checker#1375 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Mantenedores costumam responder em até 1 dia