-
-
Notifications
You must be signed in to change notification settings - Fork 389
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
Bug: pagination DI seems broken with 2.1.0 #2358
Labels
Bug 🐛
This is something that is not working as expected
Comments
nabnux
added
Bug 🐛
This is something that is not working as expected
Triage Required 🏥
This requires triage
labels
Sep 25, 2023
Here's an MCVE to reproduce: from __future__ import annotations
from litestar import Litestar
from litestar import get
from litestar.contrib.sqlalchemy.plugins import SQLAlchemySyncConfig, SQLAlchemyInitPlugin
from litestar.repository.filters import LimitOffset
from litestar.testing import TestClient
async def provide_limit_offset_pagination() -> LimitOffset:
return LimitOffset(limit=0, offset=0)
@get(
path="/",
dependencies={"limit_offset": provide_limit_offset_pagination},
)
async def handler(limit_offset: LimitOffset) -> None:
return None
app = Litestar(
route_handlers=[handler],
plugins=[SQLAlchemyInitPlugin(SQLAlchemySyncConfig(connection_string="sqlite:///"))],
debug=True,
)
with TestClient(app=app) as client:
assert client.get("/").status_code == 200 It only happens with the |
provinzkraut
added a commit
that referenced
this issue
Sep 25, 2023
…rom advanced-alchemy Signed-off-by: Janek Nouvertné <[email protected]>
@nabnux I found the source of the issue, and I have a fix pending. For now you can use this workaround: Instead of from litestar.repository.filters import LimitOffset do from advanced_alchemy.filters import LimitOffset The fix will make the regular imports work again. |
Thanks for working on this and for the workaround! |
provinzkraut
added a commit
that referenced
this issue
Sep 30, 2023
…rom advanced-alchemy Signed-off-by: Janek Nouvertné <[email protected]>
cofin
added a commit
that referenced
this issue
Sep 30, 2023
…rom advanced-alchemy (#2360) * fix(repositories): fix #2358 by re-exporting filters and exceptions from advanced-alchemy Signed-off-by: Janek Nouvertné <[email protected]> * fix docs Signed-off-by: Janek Nouvertné <[email protected]> * fix: pin adv alchemy to v0.2.2 * Update pyproject.toml * update poetry.lock Signed-off-by: Janek Nouvertné <[email protected]> --------- Signed-off-by: Janek Nouvertné <[email protected]> Co-authored-by: Cody Fincher <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Hi, I'm trying to bump Litestar to 2.1.0 on a project and I'm getting a 500 / Internal Server Error on endpoints implementing pagination (it was working fine before the bump). I've reproduced this behavior in the MCVE below, and provided the error message in the logs.
The error message apparently refers to a validation issue of the injected dependency used to provide the
limit
andoffset
parameters.The other endpoint in the MCVE that gets a single user works fine btw.
URL to code causing the issue
No response
MCVE
Steps to reproduce
Screenshots
No response
Logs
Litestar Version
2.1.0
Platform
Funding
The text was updated successfully, but these errors were encountered: