I am attempting to create a stellar-core and horizon node running under Travis-CI. (Existing solutions do not work for macOS, as Travis does not support Docker instances for test builds.) The purpose is to test an iOS SDK for communicating with Horizon nodes.

The error is as follows (formatted for readability):

INFO[0105] Starting request
    host="localhost:8000" ip="[::1]:50783" method=POST
    path="/transactions" pid=1408 req="Traviss-Mac-913.local/cd7EdAgdzz-000002"
ERRO[0108] import session failed: failed to load transactions:
    select failed: sql: Scan error on column index 5: xdr:decode:
    switch '1' is not valid for union  pid=1408

The exact same unit tests run on my local MacBook, using a horizon instance running in a Docker container.

The following is the script which establishes the nodes in Travis:


rm -rf /usr/local/var/postgres
initdb /usr/local/var/postgres -E utf8
pg_ctl -D /usr/local/var/postgres start
createuser -s postgres
psql -c 'create database core;' -U postgres
psql -c 'create database horizon;' -U postgres

pg_ctl -V

./stellar/bin/stellar-core --conf ./stellar-core.cfg --newdb --forcescp
./stellar/bin/stellar-core --conf ./stellar-core.cfg &

sleep 2

export DATABASE_URL=postgres://postgres@localhost/horizon?sslmode=disable
export STELLAR_CORE_DATABASE_URL=postgres://postgres@localhost/core?sslmode=disable
export STELLAR_CORE_URL=http://localhost:11626
export NETWORK_PASSPHRASE=private testnet
export INGEST=true

./horizon/horizon db init

./horizon/horizon serve &
  • What versions of core and horizon are you using? They can be incompatible. – Bartek Nowotarski Mar 29 '18 at 9:52
  • 1
    It turns out this was caused by building stellar-core from the HEAD of master. Using v9.1.0 works fine. – Avi Shevin Mar 30 '18 at 10:00

The issue turned out to be an incompatibility between Horizon (any version), and stellar-core built from the HEAD of master. Building v9.1.0 yields a working solution.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.