bigchaindb / bigchaindb-driver

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

"404 Not Found" error returned when bdb.transactions.send() to IPDB #319

Closed sab4tg closed 7 years ago

sab4tg commented 7 years ago

Description

What I was trying to get done: I'm new to BigchainDB and just want to set up a simple blockchain network using IPDB. I set up an application on IPDB and I want to test sending transactions to IPDB / examining those transactions from other nodes using the same app_id and app_key. Since I am new to Bigchain it is very possible I missed a setup step somewhere and the issue is something simple.

I am following the Bigchain tutorial here. I have created an asset and am using transactions.send(...) to send the transaction to the IPDB instance. I have bigchaindb / bigchaindb_driver on my computer, along with mongodb and rethinkdb, thought none of those instances are running locally. All well and good.

What I Did

When I execute the transactions.send() command, I am hit with the following error:

Traceback (most recent call last): File "test.py", line 13, in <module> bdb.transactions.send(signed_tx) File "/home/student/.local/lib/python3.5/site-packages/bigchaindb_driver/driver.py", line 319, in send method='POST', path=self.path, json=transaction, headers=headers) File "/home/student/.local/lib/python3.5/site-packages/bigchaindb_driver/transport.py", line 58, in forward_request headers=headers, File "/home/student/.local/lib/python3.5/site-packages/bigchaindb_driver/connection.py", line 57, in request raise exc_cls(response.status_code, text, json) bigchaindb_driver.exceptions.NotFoundError: (404, '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">\n<title>404 Not Found</title>\n<h1>Not Found</h1>\n<p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p>\n', None) What is weird is that when I look on the IPDB statistics page for my app, I can see the transactions are still reaching the application...I just am unable to view them from my node or other nodes.

Any words of wisdom / insight into what is causing this?

ttmc commented 7 years ago

The IPDB statistics page just reports HTTP POST requests that went through NGINX and got authenticated there. It seems that worked.

NGINX then passed the POST request on to a BigchainDB Server app, which sent back the 404 Not Found response. That's odd...

I wonder if there was anything unusual about the transaction you posted. Could you share the exact sequence of commands you used? Were they just copied straight out of the Python Driver docs, or did you make some modifications?

sab4tg commented 7 years ago

Sure. Here is the exact code I ran (condensed into a script called test.py):

from bigchaindb_driver import BigchainDB 
from bigchaindb_driver.crypto import generate_keypair 

bdb = BigchainDB('https://test.ipdb.io/api/v1/',headers={'app_id': 'secret','app_key': 'secret'}) 

alice = generate_keypair() 

tx = bdb.transactions.prepare(operation='CREATE',signers=alice.public_key,asset={'data': {'message': 'Hello World!'}}) 

signed_tx = bdb.transactions.fulfill(tx,private_keys=alice.private_key) 

bdb.transactions.send(signed_tx)

app_key and app_id taken out for obvious reasons.

I've tried to run other versions of this code where instead of a message transaction, I've used a bike or other asset type - those still return the same error code.

ttmc commented 7 years ago

Ah, okay, I see the problem. It's in the line:

bdb = BigchainDB('https://test.ipdb.io/api/v1/',headers={...})

There shouldn't be a trailing /api/v1 in the URL. I checked the instructions given on the IPDB Developer Portal and see that you probably copied those, because the line there was wrong. I fixed it. The URL should be just https://test.ipdb.io

ttmc commented 7 years ago

P.S. I tested it using your IPDB Test Network account, just to make sure it wasn't an account-related problem. If you see two POST requests made to the IPDB Test Network in the past hour by your account, those were me.