Connected Services - Error 500

Hello, today I tried to get wordpress and tumblr set up with my pod.

Whenever I go through the auth process from D* I just get an error 500 message. Running 0.7.9.0

https://public-api.wordpress.com/oauth2/authorize?client_id=64508
I click “authorize” then get error page for the redirect url below
https://brighton.social/auth/wordpress/callback?code=… = error 500

https://brighton.social/auth/tumblr -> Error 500

From diaspora.yml:

## OAuth credentials for Twitter
twitter: ## Section

  enable: true
  key: '<key>'
  secret: '<secret>'

## OAuth credentials for Tumblr
tumblr: ## Section

  enable: true
  key: '<key>'
  secret: '<secret>'

wordpress: ## Section

  enable: true
  client_id: '<id>'
  secret: '<secret>'

Any Ideas?

Would be awesome if you could dig out the relevant sections from your log/production.log for these requests :slight_smile:

The strange thing was, I didn’t see anything relevant when I grep’d the production log for relevant URLs, perhaps I was a little tired and missed something, or the error is something to do with Apache rather than a problem with the D* source code. Will check again later when I get time.

I trust these integrations are working for other people without issue?

Tried reproducing the error, and looking through the logs there is a 401 error, checked the key/secret and saw that I’d missed out the first character of the key.

So, all authorized now, BUT, my “shared” posts are not appearing on Tumblr! Grr…

Shall try and see what the problem is with WP and report back with any issues I have there.

Here is the relevant info for Tumblr from my production.log:

[2019-01-25T12:29:19] INFO  PID-24301 TID-69878127153840 Sidekiq: Workers::PostToService JID-fc975132f1b87533863598a0: start
[2019-01-25T12:29:20] INFO  PID-24301 TID-69878127153840 Sidekiq: Workers::PostToService JID-fc975132f1b87533863598a0: fail: 0.359 sec
[2019-01-25T12:29:20] WARN  PID-24301 TID-69878127153840 Sidekiq: {"context":"Job raised exception","job":{"class":"Workers::PostToService","args":[10,86322,"https://brighton.social//p/ac6a0fd002ca0137625004f655b7aac3"],"retry":10,"queue":"medium","backtrace":15,"jid":"fc975132f1b87533863598a0","created_at":1548419321.9364378,"locale":"en","enqueued_at":1548419359.9158492,"error_message":"no implicit conversion of String into Integer","error_class":"TypeError","failed_at":1548419322.2987447,"retry_count":0,"error_backtrace":["app/models/services/tumblr.rb:21:in `[]'","app/models/services/tumblr.rb:21:in `post'","app/workers/post_to_service.rb:14:in `perform'"]},"jobstr":"{\"class\":\"Workers::PostToService\",\"args\":[10,86322,\"https://brighton.social//p/ac6a0fd002ca0137625004f655b7aac3\"],\"retry\":10,\"queue\":\"medium\",\"backtrace\":15,\"jid\":\"fc975132f1b87533863598a0\",\"created_at\":1548419321.9364378,\"locale\":\"en\",\"enqueued_at\":1548419359.9158492,\"error_message\":\"no implicit conversion of String into Integer\",\"error_class\":\"TypeError\",\"failed_at\":1548419322.2987447,\"retry_count\":0,\"error_backtrace\":[\"app/models/services/tumblr.rb:21:in `[]'\",\"app/models/services/tumblr.rb:21:in `post'\",\"app/workers/post_to_service.rb:14:in `perform'\"]}"}
[2019-01-25T12:29:20] WARN  PID-24301 TID-69878127153840 Sidekiq: TypeError: no implicit conversion of String into Integer
[2019-01-25T12:29:20] WARN  PID-24301 TID-69878127153840 Sidekiq: app/models/services/tumblr.rb:21:in `[]'

I have set up a development environment on another machine so maybe I can try to take a look at the code to see if I can get it working, however I am (very) new to Ruby/Rails.

Sounds like some kind of error response (which the service should handle better, but…)

That line of code just tries to fetch the blogs from the /v2/user/info endpoint: https://github.com/diaspora/diaspora/blob/develop/app/models/services/tumblr.rb#L21

Which according to its documentation doesn’t have any optional field on the way: https://www.tumblr.com/docs/en/api/v2#userinfo--get-a-users-information

Yes was looking at L21, tried to dump the output from blogs.inspect to a file in /tmp but changes to code are ignored.

Presumably, I can’t just directly edit code in diaspora/app/models/services/… ?

I did a graceful restart of D* after my edits, not sure how to get code changes recognized, wanted to inspect the response from tumblr so as to try to work out where the problem is arising.

Are the bits in /app precompiled somewhere (the fact that it gives an error with a line number seems to suggest not)

Sorry for n00b questions :slight_smile:

Ah, this is most likely called from a sidekiq worker, so make sure to restart your sidekiq(s) after you made a change.

Maybe that has something to do with this?

Ok, this is a bit weird, but I added a second blog to my tumblr account and it now seems to be working. It may have been that or it may have been that I had altered my profile etc on tumblr.

Seems code here is a little flaky so I might try further investigation…

1 down, 1 to go (WP)

Does anybody know how long Twitter usually take to approve apps?

I know this is an old topic, but I’m going to answer this question because I just connected with Twitter.
I already had a Twitter account, but I didn’t have a developer’s account with them. I added that, and received my key within a few minutes. I’m getting a 500 error on connecting through Diaspora though, so I’m in here reading through this topic… :slight_smile:

@JerryLumpkins I posted a new thread for my Twitter integration problems.

@everybody I’m new here. Do we prefer long lived threads or focused single issue threads here?

One thread per issue please. :slight_smile: But that means “one thread per issue”, not “one thread per instance”. If you’re facing the exact same problem as someone else: reuse that topic. If you want to suggest a feature that already has a discussion: post on the existing thread. If you have something new that has not been discussed or asked before: open a new thread.

Don’t worry if you get it wrong, though. We can split and merge topics if we deem it necessary.

(Also, unfortunately, I can’t contribute anything meaningful to the issues - I have disabled the twitter integration a while ago, and I also do not know how to debug that meaningfully - sorry. But I figured answering your meta question is fine. :))

Thank you for your reply.

Don’t worry if you get it wrong, though. We can split and merge topics if we deem it necessary.

Would it be possible to have you or another admin migrate my other posts to this thread then?

I am trying to set up Twitter as a connected service to my pod. I have been approved for a Twitter developer account and have tried using key/secret pairs from

  • Projects & Apps -> Project -> {my-project} -> Consumer Keys
  • Projects & Apps -> Project -> {my-project} -> Authentication Tokens -> Access token & secret
  • Projects & Apps -> Standalone -> {my-project-v1} -> Consumer Keys -> API key & secret

Each time I have copy/pasted and verified the key and secret values to my diaspora.yml file and restarted diaspora using RAILS_ENV=production bin/eye restart web. I would then refresh my diaspora web page and click the option to connect Twitter to my account. Each time I get the “We’re sorry…” 500 error page.

log/production.log has the following relevant lines:

[2020-12-20T06:34:07] INFO  PID-740 TID-70328303516020 Rails: Started GET "/auth/twitter" for 127.0.0.1 at 2020-12-20 06:34:07 +0000
[2020-12-20T06:34:07] FATAL PID-740 TID-70328303516020 Rails:
[2020-12-20T06:34:07] FATAL PID-740 TID-70328303516020 Rails: OAuth::Unauthorized (401 Authorization Required):
[2020-12-20T06:34:07] FATAL PID-740 TID-70328303516020 Rails:
[2020-12-20T06:34:07] FATAL PID-740 TID-70328303516020 Rails: vendor/bundle/ruby/2.6.0/gems/oauth-0.5.4/lib/oauth/consumer.rb:236:in `token_request'
vendor/bundle/ruby/2.6.0/gems/oauth-0.5.4/lib/oauth/consumer.rb:155:in `get_request_token'
vendor/bundle/ruby/2.6.0/gems/omniauth-oauth-1.1.0/lib/omniauth/strategies/oauth.rb:28:in `request_phase'
vendor/bundle/ruby/2.6.0/gems/omniauth-twitter-1.4.0/lib/omniauth/strategies/twitter.rb:61:in `request_phase'

Which keys should I be using? Should I be using the v1.1 “standalone” credentials or the V2 “project” credentials? I have read the instructions on the wiki, but there is a warning they may be out of date and the Twitter instructions do not match the current processes for setting up API access.

1 Like

Additional Info:
While creating the question I noticed there is also an Authentication Tokens section under the v1.1 “standalone” app settings as well. I generated a key pair under there and it also fails in the same fashion.

Also, I verified that the app settings were set to “Read and Write” permissions and “3-Legged OAuth” enabled before the key pairs were generated.

And I have verified that the server time and timezone are correctly set.

Did you read https://wiki.diasporafoundation.org/Integrating_other_social_networks ?

Its not up-to-date, but a good starting point.

You need also enable “3 legged O-Auth” and on 'callback URLs:
https://YOUR-POD.TLD/auth/twitter/callback
Then it should work without regenerating Keys.