You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When defining synchronous error handlers in Django Ninja and attempting to access Django's ORM with synchronous operations, I encounter an error indicating that I am running the ORM in an asynchronous context. To address this, I decided to define the error handler as asynchronous so I could use Django's asynchronous ORM methods. However, this change led to a new issue:
The view ninja_extra.operation.method.__call__ didn't return an HttpResponse object. It returned an unawaited coroutine instead. You may need to add an 'await' into your view.
This suggests that the error handler, although defined as asynchronous, is being called from an asynchronous context but expects a synchronous function, as it does not properly await an asynchronous function. This issue highlights a potential inconsistency in how Django Ninja handles error contexts between synchronous and asynchronous operations.
Bug Description
When defining synchronous error handlers in Django Ninja and attempting to access Django's ORM with synchronous operations, I encounter an error indicating that I am running the ORM in an asynchronous context. To address this, I decided to define the error handler as asynchronous so I could use Django's asynchronous ORM methods. However, this change led to a new issue:
The view ninja_extra.operation.method.__call__ didn't return an HttpResponse object. It returned an unawaited coroutine instead. You may need to add an 'await' into your view.
This suggests that the error handler, although defined as asynchronous, is being called from an asynchronous context but expects a synchronous function, as it does not properly await an asynchronous function. This issue highlights a potential inconsistency in how Django Ninja handles error contexts between synchronous and asynchronous operations.
Code to Reproduce
Versions:
The text was updated successfully, but these errors were encountered: