0

When sending POST request to /v1/chain/get_account using the following code, I get 502 back.

import requests, json
url = "https://api-node.eos.mydomain.com/v1/chain/get_account"
data = {"account_name": "eosio"}
r = requests.post(url, json.dumps(data))
print(r.status_code)

And I get this error output from my EOS API node.

info  2024-01-11T08:06:28.123 nodeos    producer_plugin.cpp:749       on_incoming_block    ] Received block e0f5869cffc22cc8... #1111 @ 2024-01-11T08:06:28.500 signed by eosio [trxs: 0, lib: 1110, confirmed: 0, net: 0, cpu: 100, elapsed: 74, time: 279, latency: -376 ms]
info  2024-01-11T08:06:28.585 nodeos    producer_plugin.cpp:749       on_incoming_block    ] Received block f7e6103cc0b2fb22... #1112 @ 2024-01-11T08:06:29.000 signed by eosio [trxs: 0, lib: 1111, confirmed: 0, net: 0, cpu: 100, elapsed: 94, time: 336, latency: -414 ms]

info  2024-01-11T08:06:29.400 net-3     net_plugin.cpp:2840           create_session       ] Accepted new connection: 10.0.73.80
error 2024-01-11T08:06:29.401 net-0     net_plugin.cpp:2948           operator()           ] ["" - 16 10.0.73.80:59808] incoming message length unexpected (1414745936)
error 2024-01-11T08:06:29.401 net-0     net_plugin.cpp:3006           operator()           ] ["" - 16 10.0.73.80:59808] Closing connection
info  2024-01-11T08:06:29.401 net-0     net_plugin.cpp:1461           _close               ] ["" - 16 10.0.73.80:59808] closing
info  2024-01-11T08:06:29.501 net-1     net_plugin.cpp:4710           connection_monitor   ] p2p client connections: 5/150, peer connections: 3/3, block producer peers: 0
info  2024-01-11T08:06:29.502 net-2     net_plugin.cpp:1583           operator()           ] ["validator2:9876" - 2 10.0.73.168:9876] Sending handshake generation 1, lib 1112, head 1113, id d7fc3bbeac394e66
info  2024-01-11T08:06:29.502 net-3     net_plugin.cpp:1583           operator()           ] ["validator3:9876" - 3 10.0.73.170:9876] Sending handshake generation 1, lib 1112, head 1113, id d7fc3bbeac394e66
warn  2024-01-11T08:06:29.502 net-1     net_plugin.cpp:3445           handle_message       ] ["validator2:9876" - 2 10.0.73.168:9876] received go_away_message, reason = duplicate
info  2024-01-11T08:06:29.502 net-1     net_plugin.cpp:1461           _close               ] ["validator2:9876" - 2 10.0.73.168:9876] closing
warn  2024-01-11T08:06:29.502 net-3     net_plugin.cpp:3445           handle_message       ] ["validator3:9876" - 3 10.0.73.170:9876] received go_away_message, reason = duplicate
info  2024-01-11T08:06:29.502 net-3     net_plugin.cpp:1461           _close               ] ["validator3:9876" - 3 10.0.73.170:9876] closing

info  2024-01-11T08:06:29.960 nodeos    producer_plugin.cpp:749       on_incoming_block    ] Received block 1c50008b6ad7f7ff... #1114 @ 2024-01-11T08:06:30.000 signed by eosio [trxs: 0, lib: 1113, confirmed: 0, net: 0, cpu: 100, elapsed: 74, time: 307, latency: -39 ms]

I'm curious if it might have something to do with my EOS node being behind an Nginx proxy. Here's my Nginx proxy config.

server {
    listen 8443 http2 ssl;
    server_name api-node.eos.mydomain.com;
    ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem;
    client_max_body_size 15M;
    ##
    # disable nginx version number in Server header
    ##
    server_tokens off;

    location / {
        ##
        # Set DNS resolver to use Docker Swarm DNS, so we don't get
        # "upstream host not found" errors when Nginx starts.
        ##
        resolver 127.0.0.11 valid=30s;
        set $upstream api-node:9876;
        proxy_intercept_errors on;
        proxy_pass http://$upstream;
    }

    # Define error pages.
    include /etc/nginx/server_error_pages.conf;
}

1 Answer 1

0

I was able to fix it by proxying the traffic through to port 80 instead of port 9876. FOr reference, here's the location block of my nginx config, which fixed the issue.

server {
    listen 8443 http2 ssl;
    server_name api-node.eos.mydomain.com;
    ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem;
    client_max_body_size 15M;
    ##
    # disable nginx version number in Server header
    ##
    server_tokens off;

    location / {
        ##
        # Set DNS resolver to use Docker Swarm DNS, so we don't get
        # "upstream host not found" errors when Nginx starts.
        ##
        resolver 127.0.0.11 valid=30s;
        set $upstream api-node:80;
        proxy_intercept_errors on;
        proxy_pass http://$upstream;
    }

    # Define error pages.
    include /etc/nginx/server_error_pages.conf;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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