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

Cannot save more than 1 item per collections #825

Closed
sot1986 opened this issue Apr 27, 2024 · 4 comments
Closed

Cannot save more than 1 item per collections #825

sot1986 opened this issue Apr 27, 2024 · 4 comments

Comments

@sot1986
Copy link

sot1986 commented Apr 27, 2024

Scout Version

10.8.6

Scout Driver

Typesense

Laravel Version

11

PHP Version

8.3.6

Database Driver & Version

No response

SDK Version

No response

Meilisearch CLI Version

4.9.2

Description

When try to index any model and the collection (for that model) already exists, it can't add any other item to it.

Here an example of the error message when launching queues:

[2024-04-27 08:26:09] local.ERROR: A collection with name `users` already exists. {"exception":"[object] (Typesense\\Exceptions\\ObjectAlreadyExists(code: 0): A collection with name `users` already exists. at /var/www/html/vendor/typesense/typesense-php/src/ApiCall.php:350)
[stacktrace]
#0 /var/www/html/vendor/typesense/typesense-php/src/ApiCall.php(237): Typesense\\ApiCall->getException()
#1 /var/www/html/vendor/typesense/typesense-php/src/ApiCall.php(124): Typesense\\ApiCall->makeRequest()
#2 /var/www/html/vendor/typesense/typesense-php/src/Collections.php(65): Typesense\\ApiCall->post()
#3 /var/www/html/vendor/laravel/scout/src/Engines/TypesenseEngine.php(511): Typesense\\Collections->create()
#4 /var/www/html/vendor/laravel/scout/src/Engines/TypesenseEngine.php(59): Laravel\\Scout\\Engines\\TypesenseEngine->getOrCreateCollectionFromModel()
#5 /var/www/html/vendor/laravel/scout/src/Jobs/MakeSearchable.php(42): Laravel\\Scout\\Engines\\TypesenseEngine->update()
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Laravel\\Scout\\Jobs\\MakeSearchable->handle()
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#10 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#11 /var/www/html/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\\Container\\Container->call()
#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}()
#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\\Pipeline\\Pipeline->then()
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(124): Illuminate\\Bus\\Dispatcher->dispatchNow()
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Queue\\CallQueuedHandler->Illuminate\\Queue\\{closure}()
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#18 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(123): Illuminate\\Pipeline\\Pipeline->then()
#19 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(71): Illuminate\\Queue\\CallQueuedHandler->dispatchThroughMiddleware()
#20 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(102): Illuminate\\Queue\\CallQueuedHandler->call()
#21 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(439): Illuminate\\Queue\\Jobs\\Job->fire()
#22 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(389): Illuminate\\Queue\\Worker->process()
#23 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(176): Illuminate\\Queue\\Worker->runJob()
#24 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(139): Illuminate\\Queue\\Worker->daemon()
#25 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(122): Illuminate\\Queue\\Console\\WorkCommand->runWorker()
#26 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Queue\\Console\\WorkCommand->handle()
#27 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#28 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#29 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#30 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#31 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(212): Illuminate\\Container\\Container->call()
#32 /var/www/html/vendor/symfony/console/Command/Command.php(279): Illuminate\\Console\\Command->execute()
#33 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(181): Symfony\\Component\\Console\\Command\\Command->run()
#34 /var/www/html/vendor/symfony/console/Application.php(1049): Illuminate\\Console\\Command->run()
#35 /var/www/html/vendor/symfony/console/Application.php(318): Symfony\\Component\\Console\\Application->doRunCommand()
#36 /var/www/html/vendor/symfony/console/Application.php(169): Symfony\\Component\\Console\\Application->doRun()
#37 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(196): Symfony\\Component\\Console\\Application->run()
#38 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1183): Illuminate\\Foundation\\Console\\Kernel->handle()
#39 /var/www/html/artisan(13): Illuminate\\Foundation\\Application->handleCommand()
#40 {main}

Error is not present on previous 10.8.5 version

Steps To Reproduce

  1. Install scout driver
    composer require laravel/scout
  2. Install typesense
    composer require typesense/typesense-php
  3. Add User model to typesense config and made it searchable as per documentation
  4. Run a simple seeder like
    User::factory(2)->create();
@driesvints
Copy link
Member

cc @karakhanyans

@gdebrauwer
Copy link
Contributor

I'm having the same issue. If I downgrade to Scout v10.8.5, then the error disappears. This is probably caused by #820 (the only change from v10.8.5 to v10.8.6 according to changelog)

@driesvints
Copy link
Member

cc @AbdullahFaqeir can you share your insights here?

@AbdullahFaqeir
Copy link
Contributor

@driesvints I'll be working on it now, hopefully it'll be ready in couple of hours.

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

No branches or pull requests

4 participants