bigchaindb / bigchaindb-driver

Official Python driver for BigchainDB
https://www.bigchaindb.com
Apache License 2.0
105 stars 104 forks source link

Getting error while sending transaction over bigchaindb node #499

Open CruzzRazor opened 5 years ago

CruzzRazor commented 5 years ago

Description

I am referring http://docs.bigchaindb.com/projects/py-driver/en/latest/usage.html I am getting error while sending transaction over bigchaindb node. saying '''TransportError: (500, '{"message": "Internal Server Error"}\n', {'message': 'Internal Server Error'}, 'http://localhost:9984/api/v1/transactions/')'''

What I Did

in my bigchaindb config file

    "server": {
        "bind": "localhost:9984",
        "loglevel": "info",
        "workers": null
    },
    "wsserver": {
        "scheme": "wss",
        "host": "localhost",
        "port": 433,
        "advertised_scheme": "wss",
        "advertised_host": "secure.bleocean.com",
        "advertised_port": 9985
    },
    "tendermint": {
        "host": "localhost",
        "port": 26657
    },
and so on.....

so my rooturl becomes
bdb_root_url = 'http://localhost:9984'

I followed all steps in above docs link. now when i am sending the transaction over to a BigchainDB node using following command i am getting error:

sent_creation_tx = bdb.transactions.send_commit(fulfilled_creation_tx)

Error Msg:

---------------------------------------------------------------------------
TransportError                            Traceback (most recent call last)
<ipython-input-6-6495e0171e3f> in <module>
----> 1 sent_creation_tx = bdb.transactions.send_commit(fulfilled_creation_tx)

~/anaconda3/lib/python3.7/site-packages/bigchaindb_driver/driver.py in send_commit(self, transaction, headers)
    373             json=transaction,
    374             params={'mode': 'commit'},
--> 375             headers=headers)
    376 
    377     def retrieve(self, txid, headers=None):

~/anaconda3/lib/python3.7/site-packages/bigchaindb_driver/transport.py in forward_request(self, method, path, json, params, headers)
     80                     headers=headers,
     81                     timeout=timeout,
---> 82                     backoff_cap=backoff_cap,
     83                 )
     84             except ConnectionError as err:

~/anaconda3/lib/python3.7/site-packages/bigchaindb_driver/connection.py in request(self, method, path, json, params, headers, timeout, backoff_cap, **kwargs)
     89                 params=params,
     90                 headers=headers,
---> 91                 **kwargs,
     92             )
     93         except ConnectionError as err:

~/anaconda3/lib/python3.7/site-packages/bigchaindb_driver/connection.py in _request(self, **kwargs)
    126         if not (200 <= response.status_code < 300):
    127             exc_cls = HTTP_EXCEPTIONS.get(response.status_code, TransportError)
--> 128             raise exc_cls(response.status_code, text, json, kwargs['url'])
    129         data = json if json is not None else text
    130         return HttpResponse(response.status_code, response.headers, data)

TransportError: (500, '{"message": "Internal Server Error"}\n', {'message': 'Internal Server Error'}, 'http://localhost:9984/api/v1/transactions/')

In cmd error logs it says:

[2019-04-04 00:06:14,185] ERROR in app: Exception on /api/v1/transactions/ [POST]
Traceback (most recent call last):
  File "/home/cruzz/.local/lib/python3.6/site-packages/urllib3/connection.py", line 159, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/home/cruzz/.local/lib/python3.6/site-packages/urllib3/util/connection.py", line 80, in create_connection
    raise err
  File "/home/cruzz/.local/lib/python3.6/site-packages/urllib3/util/connection.py", line 70, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/cruzz/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/home/cruzz/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 354, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.6/http/client.py", line 1239, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1285, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1234, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/lib/python3.6/http/client.py", line 964, in send
    self.connect()
  File "/home/cruzz/.local/lib/python3.6/site-packages/urllib3/connection.py", line 181, in connect
    conn = self._new_conn()
  File "/home/cruzz/.local/lib/python3.6/site-packages/urllib3/connection.py", line 168, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7ff72dc7b2b0>: Failed to establish a new connection: [Errno 111] Connection refused

Please help me to resolve this issue.

vvaradhan commented 4 years ago

I am facing exact similar issue and I have asked about it in https://stackoverflow.com/questions/61580896/getting-error-while-sending-transaction-over-bigchaindb-node

The entire setup was running fine and the docker container had to be restarted post which, it stopped working.

I can't run tenderming unsafe_rest_all - as it would reset my existing data. Any kind help at the earliest will be highly appreciated.

Yehezkiel-simbuang commented 1 year ago

Same issue here, have you solve it? @CruzzRazor