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

Port parameter is not setting while creating GuzzleHttp\Psr7\Uri in factory.php #84

Closed
alisanalacam opened this issue Jun 3, 2020 · 2 comments
Labels

Comments

@alisanalacam
Copy link

alisanalacam commented Jun 3, 2020

Env

AWS_ACCESS_KEY_ID=****
AWS_SECRET_ACCESS_KEY=****
AWS_REGION=eu-central-1
AWS_ELASTICSEARCH_ENABLED=true
ELASTICSEARCH_HOST=https://vpc-test-****.eu-central-1.es.amazonaws.com
ELASTICSEARCH_PORT=9200
ELASTICSEARCH_SCHEME=https
ELASTICSEARCH_USER=
ELASTICSEARCH_PASS=

Usage

$data = [
        'body' => [
        ],
        'index' => 'products',
        'type' => '_search',
    ];
    $return = Elasticsearch::index($data);

Response

"exception" => GuzzleHttp\Exception\RequestException {#325 ▼
    -request: GuzzleHttp\Psr7\Request {#322 ▶}
    -response: null
    -handlerContext: array:30 [▼
      "errno" => 60
      "error" => ""
      "appconnect_time" => 0.0
      "url" => "https://vpc-test-****.eu-central-1.es.amazonaws.com/products/_search"
....

"url" => "https://vpc-test-****.eu-central-1.es.amazonaws.com/products/_search"
As it can be understood from the error output, the port is not exist

current Factory.php

$psr7Request = new \GuzzleHttp\Psr7\Request(
                        $request['http_method'],
                        (new \GuzzleHttp\Psr7\Uri($request['uri']))
                            ->withScheme($request['scheme'])
                            ->withHost($request['headers']['Host'][0]),
                        $request['headers'],
                        $request['body']
                    );

Fix Factory.php

$psr7Request = new \GuzzleHttp\Psr7\Request(
                        $request['http_method'],
                        (new \GuzzleHttp\Psr7\Uri($request['uri']))
                            ->withScheme($request['scheme'])
                            ->withPort($host['port'])
                            ->withHost($request['headers']['Host'][0]),
                        $request['headers'],
                        $request['body']
                    );

Fxied Response

"exception" => GuzzleHttp\Exception\RequestException {#325 ▼
    -request: GuzzleHttp\Psr7\Request {#322 ▶}
    -response: null
    -handlerContext: array:30 [▼
      "errno" => 60
      "error" => ""
      "appconnect_time" => 0.0
      "url" => "https://vpc-test-****.eu-central-1.es.amazonaws.com:9200/products/_search"
....

have you ever seen this problem? How can fix it?

@cviebrock
Copy link
Contributor

Sorry for the delay.

I've not encountered this issue before. Could you make a PR to add this fix, and I'll merge it in?

@cviebrock
Copy link
Contributor

Fixed by #105

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

No branches or pull requests

2 participants