Skip to content

fix: Starlette middleware async task group error#29

Merged
psincraian merged 1 commit into
mainfrom
claude/fix-starlette-middleware-error-013xsZCbPXzakuy9xVTjhUD2
Nov 19, 2025
Merged

fix: Starlette middleware async task group error#29
psincraian merged 1 commit into
mainfrom
claude/fix-starlette-middleware-error-013xsZCbPXzakuy9xVTjhUD2

Conversation

@psincraian

Copy link
Copy Markdown
Owner

No description provided.

…let error

When Jinja2 templates access the api_key.badge relationship, it was
triggering a lazy load in a synchronous context (template rendering),
which caused a MissingGreenlet error with async SQLAlchemy.

This fix adds selectinload() to eagerly load the badge relationship
when fetching API keys in three endpoints:
- /analytics
- /dashboard
- /settings

This ensures the badge data is already loaded before rendering templates,
preventing the async/sync mismatch.
@psincraian psincraian merged commit 5423487 into main Nov 19, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants