Skip to content

fix: pass --credentials to Solr 10 CLI, fail on collection creation errors - #80

Merged
stasadev merged 1 commit into
mainfrom
20261028_stasadev_solr10_fix
Oct 28, 2026
Merged

stasadev merged 1 commit into
mainfrom
20261028_stasadev_solr10_fix

Conversation

@stasadev

Copy link
Copy Markdown
Member

Short Summary (TL;DR)

Fixes the Solr 10 test failure that started with the solr:10 image moving to 10.1.0: bin/solr create got a 401, so the configset collection was never created.

The Issue

Scheduled tests fail on all runners in install from directory Solr 10 (run), showing only exit status 22 from curl -sf.

In Solr 10.1.0, bin/solr create switched to the V2 Collections API (POST /api/collections with a JSON body). Credentials from SOLR_AUTHENTICATION_OPTS (system property or solr.httpclient.config file) go through PreemptiveBasicAuthClientCustomizer, which despite its name only answers a 401 challenge. Jetty can't replay the streamed request body, so the request fails with 401. solr create ... || true hid the error and the healthcheck still passed.

Only the -u/--credentials CLI option sends the Authorization header up front.

How This PR Solves The Issue

  • Solr 10+: /etc/default/solr.in.sh (sourced by bin/solr) appends --credentials (taken from SOLR_AUTHENTICATION_OPTS) to the CLI commands that accept it in both 10.0.0 and 10.1.0. This also fixes ddev solr create etc. The solr.security.auth.basicauth.credentials system property stays as the fallback for anything not in the list.
  • The init script creates a collection only if solr zk ls /collections/<name> says it doesn't exist, without || true. A real failure now stops the init, the healthcheck fails, and the error is visible in ddev logs -s solr.
  • Tests: curl -sS --fail-with-body to show error responses, and a new ddev solr create -c ddev-test check.

Manual Testing Instructions

ddev dotenv set .ddev/.env.solr --solr-base-image "solr:10"
ddev add-on get ddev/ddev-solr --pr 80
ddev restart
ddev solr create -c test

Automated Testing Overview

bats tests/test.bats --filter "Solr 10" passes locally with Solr 10.1.0, and the same checks pass manually with solr:10.0.0.

Release/Deployment Notes

No user action needed.

🤖 Generated with Claude Code

…rrors

Solr 10.1.0 "bin/solr create" uses the V2 Collections API with a request
body. Credentials from SOLR_AUTHENTICATION_OPTS are only sent after a 401
challenge, and the body can't be replayed, so the techproducts collection
was never created and "|| true" hid the error.

- Solr 10+: append --credentials to the CLI commands that accept it
- create collections only if missing, without "|| true"
- tests: show curl error bodies, check "ddev solr create"

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@stasadev
stasadev merged commit f61cf2d into main Oct 28, 2026
4 checks passed
@stasadev
stasadev deleted the 20261028_stasadev_solr10_fix branch October 28, 2026 15:02
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

Successfully merging this pull request may close these issues.

1 participant