Cursor already closed

I’m getting the below error trigger randomly, I’ve tried everything to fix it. I don’t get this issue in local development, it’s only when i’ve deployed to Render. Any ideas? I really need help.

Oct 18 08:51:48 AM [18/Oct/2023 14:51:48] ERROR “django.request” Internal Server Error: /a/SerialTek/
Oct 18 08:51:48 AM Traceback (most recent call last):
Oct 18 08:51:48 AM File “/usr/local/lib/python3.10/site-packages/django/db/utils.py”, line 98, in inner
Oct 18 08:51:48 AM return func(*args, **kwargs)
Oct 18 08:51:48 AM psycopg2.InterfaceError: cursor already closed
Oct 18 08:51:48 AM
Oct 18 08:51:48 AM The above exception was the direct cause of the following exception:
Oct 18 08:51:48 AM
Oct 18 08:51:48 AM Traceback (most recent call last):
Oct 18 08:51:48 AM File “/usr/local/lib/python3.10/site-packages/django/core/handlers/exception.py”, line 55, in inner
Oct 18 08:51:48 AM response = get_response(request)
Oct 18 08:51:48 AM File “/usr/local/lib/python3.10/site-packages/django/core/handlers/base.py”, line 197, in _get_response
Oct 18 08:51:48 AM response = wrapped_callback(request, *callback_args, **callback_kwargs)
Oct 18 08:51:48 AM File “/usr/local/lib/python3.10/site-packages/sentry_sdk/integrations/django/views.py”, line 84, in sentry_wrapped_callback
Oct 18 08:51:48 AM return callback(request, *args, **kwargs)
Oct 18 08:51:48 AM File “/code/apps/teams/decorators.py”, line 29, in _inner
Oct 18 08:51:48 AM return view_func(request, *args, **kwargs)
Oct 18 08:51:48 AM File “/code/apps/web/views.py”, line 68, in team_home
Oct 18 08:51:48 AM if ocr_call_filter:
Oct 18 08:51:48 AM File “/usr/local/lib/python3.10/site-packages/django/db/models/query.py”, line 412, in bool
Oct 18 08:51:48 AM self._fetch_all()
Oct 18 08:51:48 AM File “/usr/local/lib/python3.10/site-packages/django/db/models/query.py”, line 1881, in _fetch_all
Oct 18 08:51:48 AM self._result_cache = list(self._iterable_class(self))
Oct 18 08:51:48 AM File “/usr/local/lib/python3.10/site-packages/django/db/models/query.py”, line 91, in iter
Oct 18 08:51:48 AM results = compiler.execute_sql(
Oct 18 08:51:48 AM File “/usr/local/lib/python3.10/site-packages/django/db/models/sql/compiler.py”, line 1595, in execute_sql
Oct 18 08:51:48 AM return list(result)
Oct 18 08:51:48 AM File “/usr/local/lib/python3.10/site-packages/django/db/models/sql/compiler.py”, line 2093, in cursor_iter
Oct 18 08:51:48 AM for rows in iter((lambda: cursor.fetchmany(itersize)), sentinel):
Oct 18 08:51:48 AM File “/usr/local/lib/python3.10/site-packages/django/db/models/sql/compiler.py”, line 2093, in
Oct 18 08:51:48 AM for rows in iter((lambda: cursor.fetchmany(itersize)), sentinel):
Oct 18 08:51:48 AM File “/usr/local/lib/python3.10/site-packages/django/db/utils.py”, line 97, in inner
Oct 18 08:51:48 AM with self:
Oct 18 08:51:48 AM File “/usr/local/lib/python3.10/site-packages/django/db/utils.py”, line 91, in exit
Oct 18 08:51:48 AM raise dj_exc_value.with_traceback(traceback) from exc_value
Oct 18 08:51:48 AM File “/usr/local/lib/python3.10/site-packages/django/db/utils.py”, line 98, in inner
Oct 18 08:51:48 AM return func(*args, **kwargs)
Oct 18 08:51:48 AM django.db.utils.InterfaceError: cursor already closed

Hi,

As this is about a specific service we’d request that you login to our dashboard and contact us via the ‘Help’ link at the top of our dashboard and make sure you pick the service that this question relates to from your account.

As this is a public forum it’s probably best not to share that directly here.

Best,

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.