Spot the bug in the async order reader

from FastAPI
FastAPI 0.141.1 / Python 3.14 intermediate 4 min 2 issues to find

This endpoint should fetch only an order visible to the current user without blocking the event loop. Find the two boundary bugs.

Python
from fastapi import FastAPI

app = FastAPI()

@app.get("/orders/{order_id}")
async def read_order(order_id: int):
    order = sync_session.get(Order, order_id)
    return {"id": order.id, "total_cents": order.total_cents}
Open in playground
Report an error