:wave: Hi everyone! At the moment I'm building a s...
# community-help
o
👋 Hi everyone! At the moment I'm building a synchronisation with a Laravel based web platform and Typesense. Everything is working fine (and quick too 😄 ). But when running the application on a worker (via a queue), I'm running into issues. There seems to be a static attribute that is called before initialisation within
ApiCall.php
. I already had contact with Jason, he suggested me to ask the question here 🙂 I'm running on php 7.4, the error is: "Symfony\Component\Debug\Exception\FatalThrowableError: Typed static property Typesense\ApiCall::$nearestNode must not be accessed before initialization in /var/www/vendor/typesense/typesense-php/src/ApiCall.php:310" When I apply changes to ApiCall.php, it works fine. When I change static::$nearestNode to $this->nearestNode, and make $nearestNode just a public (not static) attribute, everything works. Does the issue of running the code on a worker sound familiar to anyone? Any suggestions? Thank you in advance!
g
@Abdullah Al-Faqeir Something you can help with?
b
what kind of synchronization are you building?
o
Hi, thanks for your replies. I'm building a synchronisation between a database of restaurants, nice locations etc (for traveling) and Typesense. On every synchronisation, all items are pushed to typesense, after finishing, the alias is switched and then old indexes are removed. The content can change and also items can be removed, so that's why we chose for alias switching (instead of upserting and removing). Everything works fine when no queue and worker is used, but when the code runs on another instance of the application (the worker), the above described issue occurs.
a
@Olav I'm currently using typesense in a system that I'm running using laravel swoole, and everything seems to be working fine for me, I'll check the typesense-php client and make sure that it works properly with such services.
o
OK thnx, curious about your findings! For now, I made a fork with minor changes and now it works perfectly: https://github.com/Label305-Forks/typesense-php/tree/change-static-attributes