davsclaus opened a new pull request, #30706: URL: https://github.com/apache/camel/pull/30706
_Claude Code on behalf of davsclaus_ [CAMEL-27497](https://issues.apache.org/jira/browse/CAMEL-27497) The `apiKey` option (CAMEL-27479 #30684, CAMEL-27480 #30686) failed the endpoint whenever `user` was also set, even without a `password`. A user without a password never logs in: basic auth needs both. So the check rejected a configuration that works. This shows up in Kamelets. An optional property that is not set, such as `{{?user}}`, resolves from the OS env var of the same name (`USER`). So `elasticsearch-index-sink` and `opensearch-index-sink` with only `apiKey` set failed at startup. That env fallback is tracked separately as CAMEL-27498 (4.25.0). ### Changes (both components) - The component fails only when `apiKey`, `user` and `password` are all set. The message now says "Both apiKey and user and password are configured ...". - Empty values count as not set (`ObjectHelper.isNotEmpty`), for `apiKey` (no `ApiKey` header) and for `user`/`password` (camel-elasticsearch's basic-auth check was null-only; camel-opensearch was already empty-safe). - Docs: the apiKey section says a user without a password is not used. ### Tests - New: `usesTheApiKeyWhenTheUserHasNoPassword` (apiKey + user, no password: the `ApiKey` header is sent to the node, not to a redirect target) and `ignoresAnEmptyApiKey` (no `ApiKey` header; the user and password are used). - `failsWhenApiKeyAndUserAndPasswordAreSet` keeps the failing case. - Unit tests: camel-elasticsearch 58, camel-opensearch 60, all pass. `ElasticsearchApiKeyIT` passes too. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
