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

Support for effective_url #227

Open
hannesl opened this issue Nov 3, 2017 · 5 comments
Open

Support for effective_url #227

hannesl opened this issue Nov 3, 2017 · 5 comments

Comments

@hannesl
Copy link

hannesl commented Nov 3, 2017

Hi! I have a request that works fine when running against the backend, but when I use a recorded cassette I get Undefined index: effective_url. Looking in the recored cassette, i can find no record of that property/option.

The effective url concept is mentioned both in the PHP CURL docs and in the Guzzle docs. Is it something that can be added to VCR?

I've tested on 1.4.1 and 1.3.x. The backend in this case is ElasticSearch, and I'm using this stack of dependencies:

  • basemkhirat/elasticsearch 1.3.1
  • elasticsearch/elasticsearch 5.3.0
  • guzzlehttp/ringphp 1.1.0

I've tried to dig through the dependencies to find some clue as to how to implement a solution, but it's a maze. Hopefully the issue will make more sense to someone else.

Here is a stack trace:

[2017-11-02 22:54:57] testing.ERROR: ErrorException: Undefined index: effective_url in /Project/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:284
Stack trace:
#0 /Project/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php(284): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined index...', '/Users/hannes/S...', 284, Array)
#1 /Project/vendor/react/promise/src/FulfilledPromise.php(25): Elasticsearch\Connections\Connection->Elasticsearch\Connections\{closure}(Array)
#2 /Project/vendor/guzzlehttp/ringphp/src/Future/CompletedFutureValue.php(55): React\Promise\FulfilledPromise->then(Object(Closure), NULL, NULL)
#3 /Project/vendor/guzzlehttp/ringphp/src/Core.php(341): GuzzleHttp\Ring\Future\CompletedFutureValue->then(Object(Closure), NULL, NULL)
#4 /Project/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php(294): GuzzleHttp\Ring\Core::proxy(Object(GuzzleHttp\Ring\Future\CompletedFutureArray), Object(Closure))
#5 /Project/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php(171): Elasticsearch\Connections\Connection->Elasticsearch\Connections\{closure}(Array, Object(Elasticsearch\Connections\Connection), Object(Elasticsearch\Transport), Array)
#6 /Project/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Transport.php(100): Elasticsearch\Connections\Connection->performRequest('GET', '/work/work/_sea...', Array, '{"query":{"bool...', Array, Object(Elasticsearch\Transport))
#7 /Project/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Client.php(1578): Elasticsearch\Transport->performRequest('GET', '/work/work/_sea...', Array, Array, Array)
#8 /Project/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Client.php(952): Elasticsearch\Client->performRequest(Object(Elasticsearch\Endpoints\Search))
#9 /Project/vendor/basemkhirat/elasticsearch/src/Query.php(860): Elasticsearch\Client->search(Array)
#10 /Project/vendor/basemkhirat/elasticsearch/src/Query.php(828): Basemkhirat\Elasticsearch\Query->response(NULL)
#11 /Project/vendor/basemkhirat/elasticsearch/src/Query.php(799): Basemkhirat\Elasticsearch\Query->getResult(NULL)
...

Here is an abbreviated copy of my cassette:

-
    request:
        method: GET
        url: 'http://myhost:9200/work/work/_search?from=0&size=1'
        headers:
            Host: 'myhost:9200'
            Expect: null
            host: 'myhost:9200'
            Content-type: application/json
            Accept: application/json
        body: '{"query":{"bool":{"filter":[{"term":{"_id":"117037"}}]}}}'
    response:
        status:
            http_version: '1.1'
            code: '200'
            message: OK
        headers:
            content-type: 'application/json; charset=UTF-8'
            content-length: '10837'
        body: '{"took":0,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":1,"max_score":0.0,"hits":[...
@hthabet
Copy link

hthabet commented Jan 29, 2018

Hi @hannesl, have you figured this out? I am running into the same issue...

@hannesl
Copy link
Author

hannesl commented Jan 29, 2018

Not really. I ended up eliminating effective_url in my app. I made this change in a forked version of the Elasticsearch client.

@hthabet
Copy link

hthabet commented Jan 29, 2018

Ok yeah... I see your little workaround :-), not really ideal but it does the job for now.

@hthabet
Copy link

hthabet commented Feb 1, 2018

Hey @hannesl if you like, you can try to test if the patch I made to php-vcr (PR pending: #241) fixes the issue for you. It did on my end.

@hannesl
Copy link
Author

hannesl commented Feb 6, 2018

@hthabet Good job! I can't test it right now, but I hope I'll be able to come back to it.

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

No branches or pull requests

2 participants