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

Meilisearch update failure with draftAndPublish enabled: Transaction query already complete #997

Open
ratorik opened this issue Jan 10, 2025 · 7 comments · May be fixed by #998
Open

Meilisearch update failure with draftAndPublish enabled: Transaction query already complete #997

ratorik opened this issue Jan 10, 2025 · 7 comments · May be fixed by #998

Comments

@ratorik
Copy link

ratorik commented Jan 10, 2025

Description:
When updating / adding an item in the Meilisearch plugin with the draftAndPublish option enabled for a content type, the item is removed from Meilisearch, and I receive the following error:

error: Meilisearch could not add entry with id: 9: Transaction query already complete, run with DEBUG=knex:tx for more info

This issue only occurs when the draftAndPublish feature is enabled. When I disable this option, the update works as expected, and the item is correctly uploaded to Meilisearch.

Expected behavior:
The item should be updated in Meilisearch without issues.

Current behavior
The item is removed from Meilisearch, and the error is displayed. However, if the "Update" button in the plugin is pressed, the items are correctly synchronized. This likely happens because all items are deleted first and then added again during the synchronization process, bypassing the issue.

Environment (please complete the following information):

  • node
  • Meilisearch version:
  • strapi-plugin-meilisearch version: 0.13.0 / 0.13.1
  • Browser: brave
  • Strapi version: 5.6.0
@daandegooijer
Copy link

Yeah i had the same issue, its because the afterCreate lifecycle hook isn't correct. I made a patch and after that it works.

@ratorik
Copy link
Author

ratorik commented Jan 13, 2025

@daandegooijer can you share te patch you have made?

@daandegooijer
Copy link

@ratorik
Copy link
Author

ratorik commented Jan 13, 2025

@daandegooijer bedankt !

@daandegooijer
Copy link

np! Don't know if creating a PR does anything, seems like its not really maintaned.

@Strift
Copy link
Contributor

Strift commented Jan 13, 2025

Hello @daandegooijer, thanks for your help here!

A PR to fix this issue would actually be welcome. We will review and merge any PR fixing the issue that adheres to our contributing guidelines.

ratorik pushed a commit to ratorik/strapi-plugin-meilisearch that referenced this issue Jan 17, 2025
…abled

fix: resolve Meilisearch issue with draftAndPublish enabled

When updating or adding an item with draftAndPublish enabled, the item is removed from Meilisearch, and the following error occurs:

error: Meilisearch could not add entry with id: 9: Transaction query already complete

This issue is described in meilisearch#997. The item should update correctly without errors when draftAndPublish is enabled.
ratorik pushed a commit to ratorik/strapi-plugin-meilisearch that referenced this issue Jan 17, 2025
…abled

fix: resolve Meilisearch issue with draftAndPublish enabled

When updating or adding an item with draftAndPublish enabled, the item is removed from Meilisearch, and the following error occurs:

error: Meilisearch could not add entry with id: 9: Transaction query already complete

This issue is described in meilisearch#997. The item should update correctly without errors when draftAndPublish is enabled.
@daandegooijer
Copy link

Ratorik was quicker ;-) But its just a quick fix but the best way to fix this is to revamp the lifecycles and implement the strapi document way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants