Skip to content

[Bug]: Client HTTP options can only be scalars #27

@clapas

Description

@clapas

Expected behavior

I should be able to set the 'Authorization' header in my Pimcore Elasticsearch client.

Actual behavior

The following configuration throws an error 'Invalid type for path "pimcore_elasticsearch_client.es_clients.default.http_options.headers". Expected "scalar", but got "array".':

pimcore_elasticsearch_client:
    es_clients:
        default:
            hosts: '%elastic.hosts%'
            http_options:
                headers:
                    Authorization: 'ApiKey OW5tRm1wa...lYTNTdw=='

If I use a scalar, e.g:

pimcore_elasticsearch_client:
    es_clients:
        default:
            hosts: '%elastic.hosts%'
            http_options:
                headers: 'Authorization: ApiKey OW5tRm1wa...YTNTdw=='

then the error is 'Symfony\Component\HttpClient\CurlHttpClient::normalizeHeaders(): Argument #1 ($headers) must be of type array, string given'.

So, the configuration expects each HTTP option to be a scalar, but the HTTP client expects an array for some options, like headers.

Steps to reproduce

Use any of the above configurations and trigger container compilation, e.g. simply run bin/console cache:clear.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions