Skip to content
This repository has been archived by the owner on May 13, 2021. It is now read-only.

Bug with symfony/http-client #50

Closed
JexPY opened this issue Sep 26, 2020 · 8 comments
Closed

Bug with symfony/http-client #50

JexPY opened this issue Sep 26, 2020 · 8 comments

Comments

@JexPY
Copy link

JexPY commented Sep 26, 2020

As you know symfony/http-client is required in plenty of packages but it was giving me the error so I removed them to test meilisearch than installed http/guzzle6-adapter and everything seems to work ok than I installed the packages that I have removed they installed symfony/http-client and as I guess laravel gives priority to it and I am getting this error again. I have also tried to install symfony/http-client nyholm/psr7 as you suggested in readme but still getting the error. What do you think what will be solution for it.

Have also tried to update guzzle to 7.0 but still not working as expected, I think there is something with php version what will be your solution?

Using:
Laravel: 6.18.40
PHP: 7.4.5

Any request to mailisearch using symfony/http-client returns the error:

   ErrorException  : Trying to access array offset on value of type null

  at /var/www/vendor/symfony/http-client/HttpClientTrait.php:417
    413|                     $url['query'] = '?'.self::mergeQueryString(substr($url['query'] ?? '', 1), $queryDefaults, false);
    414|                 }
    415|             }
    416| 
  > 417|             $url['scheme'] = $base['scheme'];
    418|         }
    419| 
    420|         if ('' === ($url['path'] ?? '')) {
    421|             $url['path'] = '/';

  Exception trace:

  1   Illuminate\Foundation\Bootstrap\HandleExceptions::handleError()
      /var/www/vendor/symfony/http-client/HttpClientTrait.php:417

  2   Symfony\Component\HttpClient\CurlHttpClient::resolveUrl()
      /var/www/vendor/symfony/http-client/HttpClientTrait.php:141
@shokme
Copy link
Collaborator

shokme commented Sep 27, 2020

I have not problem using symfony/http-client with nyholm/psr7
laravel 6.18.40 and php 7.4.3
be sure to use "meilisearch/meilisearch-laravel-scout": "^0.12.0" in your composer.json

@JexPY
Copy link
Author

JexPY commented Sep 28, 2020

@shokme Thanks for feedback but I am using "meilisearch/meilisearch-laravel-scout": "^0.12.0"
"symfony/http-client": "^5.1"
and
"nyholm/psr7": "^1.3"
You have the same versions?

@shokme
Copy link
Collaborator

shokme commented Sep 28, 2020

yes, everything is the same.

But I do a very simple call

$movies = Movie::search('Ready Player One')->raw();

But as you said:

Any request to mailisearch using symfony/http-client returns the error:

So I don't think the error come from your call.

@JexPY
Copy link
Author

JexPY commented Sep 28, 2020

@shokme yes you are right that's not about the call, I have tried several combinations in my project so guzzle 6 with adapter works well, after clearing some packages guzzle 7 started working fine with whole config and mailisearch, but symfony/http-client still stays problem for me. If I will have any solution will write it down. Thanks for your time.

@shokme
Copy link
Collaborator

shokme commented Sep 28, 2020

Ok, I'm sorry to not be able to help you further.

perhaps doing some dd($url) around symfony/http-client/HttpClientTrait.php:417 can show you some hints.

@JexPY
Copy link
Author

JexPY commented Sep 28, 2020

@shokme Still thanks a lot for time and help, the same configuration that we both have gives me hopes that I have something mistaken so I will continue investigation thanks again.

@JexPY
Copy link
Author

JexPY commented Sep 29, 2020

@shokme So I have found out my problem was with docker configuration and env variable. I had MEILISEARCH_HOST=meilisearch in my env that was working perfectly with guzzle 6,7 and php-http/curl-client, that was driving me crazy when only symfony/http-client was crashing. So I checked vendor/symfony/http-client/HttpClientTrait.php source and found our that their resolveUrl() was crashing without "proper" url name so I changed my MEILISEARCH_HOST=meilisearch to MEILISEARCH_HOST=http://meilisearch:7070 and that's it now it works. Thanks again I am staying with meilisearch and closing issue.

@JexPY JexPY closed this as completed Sep 29, 2020
@curquiza
Copy link
Member

Thanks for your investigation @JexPY! Be sure it will be helpful for users coming after you 👍

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

No branches or pull requests

3 participants