Skip to content

Attachments array empty on the notified servers #53

Closed
jeena opened this Issue Dec 13, 2012 · 8 comments

3 participants

@jeena
jeena commented Dec 13, 2012

I am trying to get attachments working now since 0.2 is out. The thing is that it is still working nice on my own server for my own entity but still not working when someone else posts attachments.

To test it I used my own server and the entity ^jeena.net and my test account on tent.is which is ^jeena.tent.is

^jeena.tent.is is following ^jeena.net

I posted a photo type post on ^jeena.net I can get it and show the image like before, no problem.

^jeena.tent.is is notified about that post and I can show the status.content.caption but sadly the status.attachments array is empty.

@jvatic jvatic pushed a commit that referenced this issue Dec 15, 2012
Jesse Stuart Fix receiving post notifications with attachments
refs #53
c9a6e61
@jvatic jvatic pushed a commit that referenced this issue Dec 15, 2012
Jesse Stuart Set data null when placeholder attachment
refs #53

requires migration 005
b1d7a4d
@jvatic
Tent — the protocol for decentralized communication member
jvatic commented Dec 15, 2012

c9a6e61 and b1d7a4d fix this for new posts

@jvatic jvatic closed this Dec 15, 2012
@jeena
jeena commented Dec 15, 2012

Ok very nice, I tested it and the array is not empty anymore. One question though, how should I get the image? :my_api_root/posts/:id/attachments/:name will not work because it will only get my own posts. :original_post_api_root/posts/:id/attachments/:name will not work either because I'm obviously not logged in into the other entities server.

I can see that there is some code talking about some proxy in the tests, but even if I've looked at it for quite a long time I still don't understand the thoughts behind the proxy thing and how I am supposed to use it.

@jvatic jvatic pushed a commit that referenced this issue Dec 15, 2012
Jesse Stuart Add GET /posts/:entity/:id/attachments/:name
refs #53
365bc40
@jvatic
Tent — the protocol for decentralized communication member
jvatic commented Dec 15, 2012

api_root/posts/:entity/:id/attachments/:name (see 365bc40)

@jeena
jeena commented Dec 18, 2012

There still seems something not going quite right. When I post a attachment on my local server http://lala.home.jeena.net:3002 it tries to notify my other server which is http://tent.jeena.net:3002 but doing that returns this error:

:tentd-admin jeena$ [http://tent.jeena.net:3002/notifications/p36t0u] 422: {"error"=>"Invalid Attributes"}
/Users/jeena/Sites/tent/tentd/lib/tentd/model/notification_subscription.rb:118:in `notify_about'
/Users/jeena/Sites/tent/tentd/lib/tentd/model/notification_subscription.rb:24:in `notify'
/Users/jeena/Sites/tent/tentd/lib/tentd/notifications/girl_friday.rb:15:in `block in <class:Notifications>'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/work_queue.rb:147:in `call'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/work_queue.rb:147:in `block (2 levels) in start'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:86:in `call'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:86:in `block in spawn_link'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:69:in `call'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:69:in `block (2 levels) in spawn'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:212:in `block in initialize'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:377:in `watchdog'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:212:in `initialize'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:66:in `new'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:66:in `block in spawn'
[https://crawler.tent.is/tent/notifications] 400: 
/Users/jeena/Sites/tent/tentd/lib/tentd/model/notification_subscription.rb:118:in `notify_about'
/Users/jeena/Sites/tent/tentd/lib/tentd/model/notification_subscription.rb:24:in `notify'
/Users/jeena/Sites/tent/tentd/lib/tentd/notifications/girl_friday.rb:15:in `block in <class:Notifications>'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/work_queue.rb:147:in `call'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/work_queue.rb:147:in `block (2 levels) in start'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:86:in `call'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:86:in `block in spawn_link'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:69:in `call'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:69:in `block (2 levels) in spawn'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:212:in `block in initialize'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:377:in `watchdog'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:212:in `initialize'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:66:in `new'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:66:in `block in spawn'

And then when I check that post on the other server (http://tent.jeena.net) then the post is there, and the array is empty. When I don't follow from http://tent.jeena.net:3002 anymore but from http://jeena.tent.is and then post a photo with an attachment then I don't get this error for the tent.is user but instead for the crawler.tent.is:

[https://crawler.tent.is/tent/notifications] 400: 
/Users/jeena/Sites/tent/tentd/lib/tentd/model/notification_subscription.rb:118:in `notify_about'
/Users/jeena/Sites/tent/tentd/lib/tentd/model/notification_subscription.rb:24:in `notify'
/Users/jeena/Sites/tent/tentd/lib/tentd/notifications/girl_friday.rb:15:in `block in <class:Notifications>'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/work_queue.rb:147:in `call'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/work_queue.rb:147:in `block (2 levels) in start'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:86:in `call'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:86:in `block in spawn_link'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:69:in `call'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:69:in `block (2 levels) in spawn'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:212:in `block in initialize'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:377:in `watchdog'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:212:in `initialize'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:66:in `new'
/Users/jeena/.rvm/gems/ruby-1.9.3-p194/gems/girl_friday-0.10.0/lib/girl_friday/actor.rb:66:in `block in spawn'

and a bit later, I don't know if this is related I get this:

216.174.65.2 - - [18/Dec/2012 01:11:31] "POST /notifications/9alpt9 HTTP/1.1" 401 - 0.0022

When I check the attachments on the tent.is server then the attachments array is not empty but has this:

[{"type":"image/jpeg","category":"photos","name":"photo.jpeg","size":159948}]

But when I get the attachment under this url:

https://jeena.tent.is/tent/posts/http%3A%2F%2Flala.home.jeena.net/r80s3k/attachments/photo.jpeg

then response is 0 bytes long:

{"readyState":4,"responseText":"","status":200,"statusText":"OK"}

I think sadly this bug needs to be reopened again.

@titanous titanous reopened this Dec 18, 2012
@jvatic
Tent — the protocol for decentralized communication member
jvatic commented Dec 27, 2012

The other side of the exception looks like this (backtrace omitted):

#<Sequel::DatabaseError: PG::Error: ERROR:  null value in column "data" violates not-null constraint
>

Migration 005 removes the not null constraint; running rake db:migrate DATABASE_URL=postgres://localhost/tent_server will fix this.

It's probably a good idea to run rake db:migrate when updating tentd-admin as the app doesn't auto-migration anymore.

@jvatic jvatic closed this Dec 27, 2012
@jeena
jeena commented Dec 27, 2012

But that doesn't explain why the response from tent.is is 0 bytes long.

@jvatic jvatic reopened this Dec 27, 2012
@jvatic jvatic pushed a commit that referenced this issue Dec 27, 2012
Jesse Stuart Fix attachment proxy when running on unicorn
refs #53
f3ef4aa
@jvatic
Tent — the protocol for decentralized communication member
jvatic commented Dec 28, 2012

f3ef4aa appears to have fixed this issue

@jvatic jvatic closed this Dec 28, 2012
@jeena
jeena commented Dec 28, 2012

Holy! I'm excited, it works! Thanks for the hard work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.