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

Unhandled Typesense error in index batch #90

Open
EricOuma opened this issue May 8, 2024 · 0 comments
Open

Unhandled Typesense error in index batch #90

EricOuma opened this issue May 8, 2024 · 0 comments
Assignees

Comments

@EricOuma
Copy link
Contributor

EricOuma commented May 8, 2024

Description

If a save signal is fired and the model instance had not been indexed, this error occured

How To Reproduce

Steps to reproduce the behavior:

  1. Create a model instance (disable the signals from firing to simulate case where indexing is not done) using .create
  2. Retrieve the instance and call .save on it

Expected behavior

ObjectNotFound: [Errno 404] Could not find a document with id: 115554
File "django_typesense/collections.py", line 357, in _update_single_document
.update(document)
File "typesense/document.py", line 17, in update
return self.api_call.patch(self._endpoint_path(), document, params)
File "typesense/api_call.py", line 154, in patch
return self.make_request(requests.patch, endpoint, True,
File "typesense/api_call.py", line 116, in make_request
raise ApiCall.get_exception(r.status_code)(r.status_code, error_message)
ServerError: [Errno 500] Unhandled Typesense error in index batch, check logs for details.
File "celery/app/trace.py", line 760, in protected_call
return self.run(*args, **kwargs)

File "apps/common/models.py", line 102, in save
super().save(*args, **kwargs)
File "django/db/models/base.py", line 814, in save
self.save_base(
File "django/db/models/base.py", line 892, in save_base
post_save.send(
File "django/dispatch/dispatcher.py", line 176, in send
return [
File "django/dispatch/dispatcher.py", line 177, in
(receiver, receiver(signal=self, sender=sender, **named))
File "django_typesense/signals.py", line 12, in post_save_typesense_models
sender.get_collection(instance, update_fields=kwargs.get('update_fields', [])).update()
File "django_typesense/collections.py", line 346, in update
return self._update_single_document(self.data[0])
File "django_typesense/collections.py", line 362, in _update_single_document
return client.collections[self.schema_name].documents.upsert(
File "typesense/documents.py", line 44, in upsert
return self.api_call.post(self._endpoint_path(), document, params)
File "typesense/api_call.py", line 144, in post
return self.make_request(requests.post, endpoint, as_json,
File "typesense/api_call.py", line 130, in make_request
raise last_exception
File "typesense/api_call.py", line 116, in make_request
raise ApiCall.get_exception(r.status_code)(r.status_code, error_message)

Environment Details (please complete the following information)

  • OS: [e.g. Ubuntu 22.04]

  • Versions:

    • Python: [e.g. 3.10]
    • Django: [e.g. 4.2]
    • django_typesense: [e.g. 0.1.3]

Additional context
Add any other context about the problem here.

Screenshots

If applicable, add screenshots to help explain your problem.

@EricOuma EricOuma self-assigned this May 8, 2024
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

No branches or pull requests

1 participant