Fix core version appearing as empty string in Horizon API #704
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Horizon root resource was returning an empty string for
core_version
when querying the API endpoint. This was causing confusion for users trying to determine which version of stellar-core was running.Issue:
Root Cause:
Horizon requires the
STELLAR_CORE_VERSION
environment variable to populate thecore_version
field in its API response. The quickstart container was not setting this environment variable, even though it had access to the stellar-core version information.Solution:
stellar-core version
STELLAR_CORE_VERSION
environment variableChanges:
start()
function:export STELLAR_CORE_VERSION=$(stellar-core version 2>/dev/null | head -1 | xargs)
export STELLAR_CORE_VERSION=$STELLAR_CORE_VERSION
After Fix:
The fix is minimal (4 lines), robust, and handles edge cases gracefully (missing binary, command failures, etc.).
Fixes #643.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.