Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

422 Error in demo: POST /api/forms/select #275

Open
charlie-corus opened this issue Apr 17, 2024 · 1 comment
Open

422 Error in demo: POST /api/forms/select #275

charlie-corus opened this issue Apr 17, 2024 · 1 comment
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@charlie-corus
Copy link

charlie-corus commented Apr 17, 2024

I'm running a local copy of the demo and there's an issue with the Select form. Pressing "Submit" throws a server-side error, and the post router method is never run.

I think the problem comes from the multiple select fields. Commenting these out, or converting them to single fields, fixes the problem, and the Submit button triggers to goto event leading back to the root URI. I read in other issues on here that arrays types in forms are not yet supported. For clarity, perhaps this should be removed from the demo until they are?

Also, I tried adding a handler like this in demo/__init__.py:

from fastapi.exceptions import RequestValidationError
from fastapi.responses import JSONResponse
from fastapi import status

@app.exception_handler(RequestValidationError)
async def validation_exception_handler(request, exc):
    print(f"Caught 422 exception on request:\n\{request}\n\n")
    return JSONResponse(
        status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
        content={"detail": exc.errors(), "body": exc.body},
    )

The 422 event is printed to the console, but the handler never gets fired. Why is this?

@charlie-corus charlie-corus changed the title 422 Error in demo: POST 422 Error in demo: POST /api/forms/select Apr 17, 2024
@sydney-runkle sydney-runkle added bug Something isn't working documentation Improvements or additions to documentation labels May 2, 2024
@sydney-runkle
Copy link
Member

@charlie-corus,

Thanks for reporting this! Definitely looks like a bug in the demo. I'll have a bit more time later in the month to hone in on FastUI, so I can take a closer look at a fix then!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants