Skip to content

FastAPI Bug with List Input #1763

@williambarberjr

Description

@williambarberjr

Environment

SaaS (https://sentry.io/)

Version

No response

Steps to Reproduce

Can be reproduced by running the following simplified fastapi app on an arm ampere cpu (probably the only unique thing about my environment), ubuntu 22.04 on oracle's cloud.

from fastapi import FastAPI
from pydantic import BaseModel

import sentry_sdk

sentry_sdk.init(
    #change this for reproducing
    dsn="https://mystring.ingest.sentry.io/mystringunique",

    traces_sample_rate=1.0,
)

app = FastAPI()


class UrlsList(BaseModel):
    urls: list[str]


@app.post('/v1/urlListInput')
async def urlListInput(urls: UrlsList):
    return urls

When I submit a post request to the /v1/urlsListInput endpoint with the following body:

{
  "urls": [
    "string"
  ]
}

It should return that body back to me. But instead I get:

{
  "detail": "There was an error parsing the body"
}

Expected Result

{
  "urls": [
    "string"
  ]
}

Actual Result

{
  "detail": "There was an error parsing the body"
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions