Steem Load Balancer: Fix Invalid Request due to Header Not Set
Both Load Balancer Nodes for STEEM have been updated:
- https://api.steemyy.com (London, UK)
- https://steem.justyy.com (USA)
Repo: https://github.com/DoctorLai/steem-load-balancer
I've come across this bug - which I need to spend some time debugging:
curl -s -X POST --data '{"jsonrpc":"2.0", "method":"condenser_api.get_account_count", "params":[], "id":1}' https:/
/api.steemyy.com | jq
{
"jsonrpc": "2.0",
"id": null,
"error": {
"code": -32600,
"message": "Invalid Request",
"data": {
"error_id": "99d35fc4-804e-49a1-9613-98b4a9cdc0ec",
"jussi_request_id": "001102709905755570"
}
}
}
It turns out when -H "content-type:application/json"
is not set, the request body is treated as string instead of JSON. Thus, fixing it:
https://github.com/DoctorLai/steem-load-balancer/pull/18/files
I've also add this failure as tests.
## This tests the load balancer by sending a POST request to the server and checking the response
## curl -s --data '{"jsonrpc":"2.0", "method":"condenser_api.get_account_count", "params":[], "id":1}' https://api.steemyy.com | jq
send_request_condenser_api_get_account_count() {
resp=$(curl -k -s -m 5 --data '{"jsonrpc":"2.0", "method": "condenser_api.get_account_count", "params": [], "id":1}' http://127.0.0.1:443/)
echo "Response: $resp"
## resp = {"jsonrpc":"2.0","result":1931791,"id":1}
## get jsonrpc, result, and id
resp_jsonrpc=$(echo $resp | jq -r '.jsonrpc')
resp_result=$(echo $resp | jq -r '.result')
resp_id=$(echo $resp | jq -r '.id')
## check if the response is OK and the version is correct
## check if resp_result is a valid number
if [ "$resp_jsonrpc" != "2.0" ] || [ "$resp_id" != "1" ] || ! [[ "$resp_result" =~ ^[0-9]+$ ]]; then
echo "send_request_condenser_api_get_account_count failed: $resp"
return 1
fi
echo "send_request_condenser_api_get_account_count passed!"
return 0
}
Steem to the Moon🚀!
- You can rent Steem Power via rentsp!
- You can swap the TRON:TRX/USDT/USDD to STEEM via tron2steem!
- You can swap the STEEM/SBD to SUI via steem2sui!
- You can swap the STEEM/SBD to SOL (Solana) via steem2sol!
- You can swap the STEEM/SBD to ETH (Ethereum) via steem2eth!
- You can swap the STEEM/SBD to Tether USDT (TRC-20) via steem2usdt!
- You can swap the STEEM/SBD to TRX (TRON) via steem2trx!
- You can swap the STEEM/SBD to BTS (BitShares) via steem2bts!
- Register a free STEEM account at SteemYY!
- Steem Block Explorer
- ChatGPT/Steem Integration: You can type !ask command to invoke ChatGPT
- Steem Witness Table and API
- Other Steem Tools
I will always support you now and vote for @justyy . withness I have voted for two or three witnesses before. I voted for the pennsif.witness first and now I will vote for you. Okay thanks and Good luck for the next. Once again I always support you.
Thank you.
Welcome Dear friend .