bigchaindb / js-bigchaindb-driver

Official BigchainDB JavaScript driver for Node.js and the browser
https://docs.bigchaindb.com/projects/js-driver/en/latest/usage.html
Apache License 2.0
216 stars 92 forks source link

message: 'HTTP Error: Requested page not reachable', status: '500 INTERNAL SERVER ERROR', requestURI: 'http://localhost:9984/api/v1/transactions?mode=commit' #297

Open amankakar opened 5 years ago

amankakar commented 5 years ago

Testing local bigchaindb node gives Error

I am following bigchaindb Basic usage example from bigchaindb docs. https://docs.bigchaindb.com/projects/js-driver/en/latest/usage.html. I am using following versions : bigchaindb : 2.0 bigchaindb-driver: 4.0.0

Running following code

const driver = require('bigchaindb-driver') const alice = new driver.Ed25519Keypair() const conn = new driver.Connection('http://localhost:9984/api/v1/') const tx = driver.Transaction.makeCreateTransaction( { message: 'Blockchain all the things!' }, null, [ driver.Transaction.makeOutput( driver.Transaction.makeEd25519Condition(alice.publicKey))], alice.publicKey) const txSigned = driver.Transaction.signTransaction(tx, alice.privateKey) console.log(txSigned) conn.postTransactionCommit(txSigned)

I Face following Errors

In node console : { message: 'HTTP Error: Requested page not reachable', status: '500 INTERNAL SERVER ERROR', requestURI: 'http://localhost:9984/api/v1/transactions?mode=commit' }

From bigchaindb server console :

Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1949, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1935, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/usr/local/lib/python3.6/dist-packages/flask_restful/__init__.py", line 458, in wrapper resp = resource(*args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/flask/views.py", line 89, in view return self.dispatch_request(*args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/flask_restful/__init__.py", line 573, in dispatch_request resp = meth(*args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/bigchaindb/web/views/transactions.py", line 98, in post status_code, message = bigchain.write_transaction(tx_obj, mode) File "/usr/local/lib/python3.6/dist-packages/bigchaindb/lib.py", line 95, in write_transaction response = self.post_transaction(transaction, mode) File "/usr/local/lib/python3.6/dist-packages/bigchaindb/lib.py", line 90, in post_transaction return requests.post(self.endpoint, json=payload) File "/usr/local/lib/python3.6/dist-packages/requests/api.py", line 116, in post return request('post', url, data=data, json=json, **kwargs) File "/usr/local/lib/python3.6/dist-packages/requests/api.py", line 60, in request return session.request(method=method, url=url, **kwargs) File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 533, in request resp = self.send(prep, **send_kwargs) File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 646, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python3.6/dist-packages/requests/adapters.py", line 516, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=26657): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f21900ae4a8>: Failed to establish a new connection: [Errno 111] Connection refused',))

LuffySmile commented 4 years ago

I have the same problem, how do you solve it

MsalekM commented 3 years ago

the same problem, any ideas ?

getlarge commented 3 years ago

@PayResto How do you call makeCreateTransaction method ? I suspect that for @amankakar the null metadata argument might cause some issues, i think i encountered this problem few days ago.

MsalekM commented 3 years ago

@getlarge I don't understand, when I restart the server it works, and it happens again after a few hours i use the example in index page like this

const tx = BigchainDB.Transaction.makeCreateTransaction(
                // Define the asset to store, in this example it is the current temperature
                // (in Celsius) for the city of Berlin.
                { city: 'Berlin, DE', temperature: 22, datetime: new Date().toString() },

                // Metadata contains information about the transaction itself
                // (can be `null` if not needed)
                { what: 'My first BigchainDB transaction' },

                // A transaction needs an output
                [ BigchainDB.Transaction.makeOutput(
                        BigchainDB.Transaction.makeEd25519Condition(alice.publicKey))
                ],
                alice.publicKey
            )

is not a driver problem