Skip to content

Custom setApiHost ignored in 1.20.0 #272

@apuig

Description

@apuig

Describe the bug
After upgrading from 1.19.2 to 1.20.0, our tests started failing.

Upon investigation, we found that the value provided to setApiHost is being overwritten by the settings retrieved from the cdhHost/v1/projects/XXX/settings. If we simulate a failure retrieving settings, the default apiHost it also used:

analytics-kotlin.properties        
segment.settings={"integrations"\:{"Segment.io"\:{"apiKey"\:"XXX","apiHost"\:"api.segment.io/v1"}}}

To Reproduce

  1. Instantiate the client using ConfigurationBuilder#setApiHost to set a custom endpoint (e.g., a mock endpoint for testing)
  2. Send some events
  3. Observe that the events are sent to the default apiHost (api.segment.io/v1), rather than the endpoint specified

Expected behavior
The configuration option provided via setApiHost should take precedence and be respected.

Platform (please complete the following information):

  • Library Version in use: 1.20.0
  • Platform being tested: java server
  • Integrations in use: -

Additional context
We managed to work around this issue by also mocking the settings requests to include the desired apiHost.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions