philippkueng / node-neo4j

Neo4j REST API wrapper for Node.js
MIT License
211 stars 44 forks source link

node-neo4j on heroku instance #27

Closed ctippur closed 10 years ago

ctippur commented 10 years ago

Hello -

I am having trouble inserting node on neo4j hosted on heroku.

I am able to add index but when I call db.insertNode, I see that it is not inserting data. It just creates a node (without any payload).

I have adb connection like this.. db = new neo4j(''http://USER:PASSWORD@instance.hosted.neo4j.org:7789' || http://localhost:7474');

As you can see, the below snippet throws data when used locally but not on heroku

db.insertNode(node,function(err, node){ if(err) throw err; console.log('Inserting node..'); console.log(node); insertIndex (node, index_name, cb); });

Appreciate any help in resolving this issue. I am losing sleep over this.

electrichead commented 10 years ago

What does your node object look like?

ctippur commented 10 years ago

Here is a healthy one ..

Inserting node.. { extensions: {}, paged_traverse: 'http://localhost:7474/db/data/node/54642/paged/traverse/{returnType}{?pageSize,leaseTime}', outgoing_relationships: 'http://localhost:7474/db/data/node/54642/relationships/out', traverse: 'http://localhost:7474/db/data/node/54642/traverse/{returnType}', all_typed_relationships: 'http://localhost:7474/db/data/node/54642/relationships/all/{-list|&|types}', property: 'http://localhost:7474/db/data/node/54642/properties/{key}', all_relationships: 'http://localhost:7474/db/data/node/54642/relationships/all', self: 'http://localhost:7474/db/data/node/54642', properties: 'http://localhost:7474/db/data/node/54642/properties', outgoing_typed_relationships: 'http://localhost:7474/db/data/node/54642/relationships/out/{-list|&|types}', incoming_relationships: 'http://localhost:7474/db/data/node/54642/relationships/in', incoming_typed_relationships: 'http://localhost:7474/db/data/node/54642/relationships/in/{-list|&|types}', create_relationship: 'http://localhost:7474/db/data/node/54642/relationships', data: { name: 'test', last_upd: '2013-12-17T05:17:36.122Z', cr_date: '2013-12-17T05:17:36.122Z', type: 'category' }, id: '54642' }

On heroku ..

Inserting node.. 2013-12-17T04:57:56.319067+00:00 app[web.1]: { extensions: {}, 2013-12-17T04:57:56.319067+00:00 app[web.1]: paged_traverse: 'http://29604e609.hosted.neo4j.org:7789/db/data/node/56/paged/traverse/{returnType}{?pageSize,leaseTime}', 2013-12-17T04:57:56.319067+00:00 app[web.1]: outgoing_relationships: 'http://29604e609.hosted.neo4j.org:7789/db/data/node/56/relationships/out', 2013-12-17T04:57:56.319067+00:00 app[web.1]: traverse: 'http://29604e609.hosted.neo4j.org:7789/db/data/node/56/traverse/{returnType}', 2013-12-17T04:57:56.319067+00:00 app[web.1]: all_typed_relationships: 'http://29604e609.hosted.neo4j.org:7789/db/data/node/56/relationships/all/{-list|&|types}', 2013-12-17T04:57:56.319067+00:00 app[web.1]: property: 'http://29604e609.hosted.neo4j.org:7789/db/data/node/56/properties/{key}', 2013-12-17T04:57:56.319067+00:00 app[web.1]: all_relationships: 'http://29604e609.hosted.neo4j.org:7789/db/data/node/56/relationships/all', 2013-12-17T04:57:56.319067+00:00 app[web.1]: self: 'http://29604e609.hosted.neo4j.org:7789/db/data/node/56', 2013-12-17T04:57:56.319067+00:00 app[web.1]: properties: 'http://29604e609.hosted.neo4j.org:7789/db/data/node/56/properties', 2013-12-17T04:57:56.319067+00:00 app[web.1]: outgoing_typed_relationships: 'http://29604e609.hosted.neo4j.org:7789/db/data/node/56/relationships/out/{-list|&|types}', 2013-12-17T04:57:56.319248+00:00 app[web.1]: incoming_relationships: 'http://29604e609.hosted.neo4j.org:7789/db/data/node/56/relationships/in', 2013-12-17T04:57:56.319248+00:00 app[web.1]: incoming_typed_relationships: 'http://29604e609.hosted.neo4j.org:7789/db/data/node/56/relationships/in/{-list|&|types}', 2013-12-17T04:57:56.319248+00:00 app[web.1]: create_relationship: 'http://29604e609.hosted.neo4j.org:7789/db/data/node/56/relationships', 2013-12-17T04:57:56.319248+00:00 app[web.1]: data: {}, 2013-12-17T04:57:56.319248+00:00 app[web.1]: id: '56' }

As you can see, data is empty.

philippkueng commented 10 years ago

Hi @ctippur,

Sorry it's bugging you. Which version of node-neo4j are you using?

Cheers, Phil

philippkueng commented 10 years ago

Can you also tell us which version of neo4j you're running locally, and if you're running 1.8.1 stable on heroku or the preview version. I ran into some issues with heroku when upgrading my 1.8.1-preview instance to 1.8.1 stable. If that's the case too with you, you might want to try a stable version on http://www.graphenedb.com and see wether the error is still there.

ctippur commented 10 years ago

neo4j version is 1.8.1. Let me check the version of node-neo4j ... not sure how to check this on heroku. It has been a month and on our package.json I have "node-neo4j": "~1.0.4"

philippkueng commented 10 years ago

ok, that's the version with the hash-value 9c96d885c23743d8cbe039bb901c37a982e50351 - it's the lastest release that's fully compatible with pre Neo4j 2.0.0 versions. I'll look into it right away.

To check the neo4j version on heroku, go to dashboard.heroku.com > with your app, click on the resources link > there click on the Neo4j addon. This should open a page where the version is displayed on the upper left.

ctippur commented 10 years ago

Phil -

Thanks for the response. neo4j version on heroku is 1.8.1. I am not sure how to upgrade that to 1.9.X or 2.X version (on heroku).

Just another observation is that I am able to add index .. db.insertNodeIndex(index_name, function(err, result) on heroku. Right after this when I try to insert a node, i get into this issue. I was not sure if there is a way to turn on debug to see what is going on.

philippkueng commented 10 years ago

Sounds like there's some kind of locking going on. Heroku has a log output on their Neo4j-Addon site https://heroku-production.neo4cloud.net - maybe there's something in there.

Regarding 1.9.X and 2.X - heroku is still stuck with 1.8.1 and for quite a while so. They don't really seem to be doing any work on it. However the guys from graphenedb are providing basically the same service but with a lot more options to choose from, including a 1.8.3 release which is the stable 1.8.X release one should be using.

I just tried running the tests against the heroku instance, but my Uni seems to be blocking the ports. Will have try again later. Will keep you posted. Sorry.

ctippur commented 10 years ago

Phil -

Good point. I just noticed that there are 2 calls but on heroku, I see that the console.log message appears twice "Inserting node.."

127.0.0.1 - - [Tue, 17 Dec 2013 18:33:04 GMT] "GET /addGlobalCategory?name=test1 HTTP/1.1" 200 79 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36"

and

127.0.0.1 - - [Tue, 17 Dec 2013 18:33:05 GMT] "GET /addGlobalCategory?name=test1 HTTP/1.1" 200 79 "http://localhost:3000/addGlobalCategory?name=test1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36"

ctippur commented 10 years ago

Phil -

Any progress?

philippkueng commented 10 years ago

Hi Shekar,

Not really. Today was my last day at Uni for this semester and couple of things were due.

Regarding your issue, I ran the v1.0.4 of node-neo4j against both the 1.8.1 from heroku and 1.8.3 on graphenedb and both returned a couple of errors in the unit tests. While those are errors that we can fix i wonder wether you need a 1.8.1 version or if you wouldn't want to upgrade to the new 2.0.0 release which has much more powerful cypher query support.

I only now realised that the current version on github with which all the tests pass on a local 2.0.0. neo4j instance, a couple of them break when using a 2.0.0 Neo4j instance on GrapheneDB. Will investigate that further, but it might take me a day. Will keep you posted.

Sorry for the delay. Phil

ctippur commented 10 years ago

Phil -

Again, Thanks for getting back on this. Wondering what tests failed on heroku? Anything to do with db.insertNode? I was also wondering if there is a way to run neo4j / node-neo4j call on debug mode? Hard thing is that we have a limited set of operations we can do on Heroku.

philippkueng commented 10 years ago

Hi Shekar,

I have good and bad news. The bad news is that it's still not working and needs some more time which i'll have after friday. The good news is that there were indeed a couple of errors in the code. It was correct enough to pass locally but failed on external versions. Since i've always run my own machine i've not found them. Thanks

As mentioned before i will have some time on this weekend to fix those things, hope that's ok for your projects schedule.

Phil

ctippur commented 10 years ago

Phil -

Thanks again for keeping me in the loop. Looking forward to getting this resolved. Please let me know if there is any way i can help.

philippkueng commented 10 years ago

Hi Shekar,

I found one bug and am really close to fixing the second one too. However the database hoster i'm using is having connection issues, will have to move my setup to another one. Shouldn't be long though until it's fixed.

Phil

ctippur commented 10 years ago

Phil -

Really appreciate you looking into this. Hope this dint eat up your precious weekend.

philippkueng commented 10 years ago

Hi @ctippur

it's all working now on 2.0.0 and 1.8.3. ...there's still a bug with 1.8.1 that i think is an encoding one and that i'll tackle in about 5-6 hours.

2.0.0 works with the develop branch 1.8.3 works with the pre-neo4j-2.0.0 branch

I'll keep you posted. Phil

ctippur commented 10 years ago

Thanks a lot. I think Heroku is on 1.8.1.

philippkueng commented 10 years ago

Yes it is, that's why it'll take me a little longer to fix those specific bugs too. I'll probably get to it tonight and otherwise tomorrow morning.

On Sunday, December 22, 2013, ctippur wrote:

Thanks a lot. I think Heroku is on 1.8.1.

  • Shekar

— Reply to this email directly or view it on GitHubhttps://github.com/philippkueng/node-neo4j/issues/27#issuecomment-31094916 .

philippkueng commented 10 years ago

Hi @ctippur,

It's fixed now. The error was a dumb one. Instead of posting the data with the JSON format i did a form request, which newer version and somehow the localhost one understood, but just not the heroku one.

Anyway, got it fixed now and released a new and improved version 1.0.5 to npmjs.org

So give it a try and let me know in case anything else pops up.

Tested it on 1.8.1, 1.8.3, 1.9.5 and 2.0.0 (cypher queries with optional '?' characters fail, but they have to since Neo4j changed something in the query structure)

Cheers Phil