Closed ghost closed 5 years ago
hey... Thanks for posting the bug. will you please post your code? So that I can test in my local, and pinpoint the issue. But probably it's because of the second argument of str_split
, that calculation is returning probably a negative number because the buffer size might be too low. Still no clue about why setting the old password does fix the issue. Let me know your ideas
Hey, thank you for answering so fast. Didn't have the time to look through all the code, but I ll do as soon as I can.
I am using the php client on Laravel, setting Sonic as an external service and the connection arguments of the channel as environmental variables (host
, port
and password
). This is a simplification of my code (actually pretty similar to the examples).
class SonicHandler {
private $host;
private $port;
private $password;
public function __construct(){
$this->host = config('services.sonic.host'); //defined in env file
$this->port = config('services.sonic.port'); //defined in env file
$this->password = config('services.sonic.password'); //defined in env file
}
public function ingestSlug(){
$ingest = new Psonic\Ingest(new Psonic\Client($this->host, $this->port));
$control = new Psonic\Control(new Psonic\Client($this->host, $this->port));
$ingest->connect($this->password); //<- IT FAILS HERE
$control->connect($this->password);
$stat = $ingest->push('collection', 'bucket', 'key', 'search_text')->getStatus();
I thought at first it was not passing correctly the environmental variables but as host and port are correct, don't see the problem there.
Now, for the password. This is autogenerated key that contains special characters like for example "%gVZ8*5aONL6O#x7TEydEHX35Oo2@@"
. Don't think the password itself is the problem so it is passed as a literal.
To be honest, didn't try yet with overwrite the default password with the default password. I mean, passing 'SecretPassword' as an argument.
hmm... pretty strange issue. because I tried with really long passwords to check if it is related to the buffer size, but all of my tests are passing. So I have one more question, how are you setting the password of the sonic engine? via the .cfg
file? then can you make sure the password of the sonic engine and the password you provide in the client are same?
Yes, I am using the cgf file. I am quite sure is the same password though. Not much different from the original one quoted in the default .cfg. Is working the same configuration for you then? I will take a look again tomorrow to see if I can find the problem.
the password you generate (ie:%gVZ8*5aONL6O#x7TEydEHX35Oo2@@
) should be equal to the one in config.cfg
's auth_password
configuration. If you still face issue, lets do a screenshare over zoom or skype
Ok, after a couple hours looking for this problem, I found there was a bug in the way the Laravel function encodes the string, so in the end resulted in a completely different one (I guess this is due to special characters inside the password). Already solved that issue and works like a charm, thanks man.
Hi
Still getting errors when setting a password on the channel connection. In this case:
str_split(): The length of each segment must be greater than zero
I thought at the beginning it was a malconfiguration on the client but when I set the password back to the default one (SecretPassword) worked like a charm. Do you have an idea what it can be?