glitch-soc / mastodon

A glitchy but lovable microblogging server
https://glitch-soc.github.io/docs/
GNU Affero General Public License v3.0
690 stars 184 forks source link

NoMethodError: undefined method `href' for nil:NilClass when following friendica account #570

Closed rtucker closed 6 years ago

rtucker commented 6 years ago

A vulpine.club user reports that they get a 500 when trying to follow an account on a Friendica instance.

The account: @vvelox@goatdaddy.net

The server errors:

rtucker@smithwicks:~/dev/mastodon$ docker-compose logs web | grep 9882cbed-8fa6-4a62-93b0-09156c5c0e45
web_1         | [9882cbed-8fa6-4a62-93b0-09156c5c0e45] method=POST path=/api/v1/accounts/40753/follow format=html controller=Api::V1::AccountsController action=follow status=500 error='NoMethodError: undefined method `href' for nil:NilClass' duration=554.05 view=0.00 db=3.55
web_1         | [9882cbed-8fa6-4a62-93b0-09156c5c0e45]   
web_1         | [9882cbed-8fa6-4a62-93b0-09156c5c0e45] NoMethodError (undefined method `href' for nil:NilClass):
web_1         | [9882cbed-8fa6-4a62-93b0-09156c5c0e45]   
web_1         | [9882cbed-8fa6-4a62-93b0-09156c5c0e45] app/services/resolve_account_service.rb:150:in `actor_url'
web_1         | [9882cbed-8fa6-4a62-93b0-09156c5c0e45] app/services/resolve_account_service.rb:193:in `actor_json'
web_1         | [9882cbed-8fa6-4a62-93b0-09156c5c0e45] app/services/resolve_account_service.rb:100:in `handle_activitypub'
web_1         | [9882cbed-8fa6-4a62-93b0-09156c5c0e45] app/services/resolve_account_service.rb:48:in `block in call'
web_1         | [9882cbed-8fa6-4a62-93b0-09156c5c0e45] app/services/resolve_account_service.rb:43:in `call'
web_1         | [9882cbed-8fa6-4a62-93b0-09156c5c0e45] app/services/follow_service.rb:12:in `call'
web_1         | [9882cbed-8fa6-4a62-93b0-09156c5c0e45] app/controllers/api/v1/accounts_controller.rb:20:in `follow'

The account info on my end:

irb(main):003:0> pp Account.find(40753)
#<Account:0x000055b6d3a5b498
 username: "vvelox",
 domain: "goatdaddy.net",
 secret: "",
 private_key: nil,
 public_key:
  "-----BEGIN PUBLIC KEY-----\n" +
  "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuaE0csjyQphAO4ffoQM/\n" +
  "Hb4E9XvazJdRbJU478j0TeOi/z52BcBpq4ztu0+TsxjCywY4fN/UYSz4rnIgH2qw\n" +
  "6XdamY498yhYikSsBDsftTeuNwjSyx+BYsaMUt5Ms0WTLRHXHGgWXdhxIkYy/cuZ\n" +
  "Yw5XG8Bnk2nI6EHELvDz4CTRNqRUernKubOJvQ7+zug7pxhF0h9xpIG4G3EXqjW7\n" +
  "hvJE/6eGr6VgxoA7JXDq1dr/skTStlNUlkAUkwShARJMVaX6/HCykYhQ3y6Qw/oF\n" +
  "6SC6hedwHpekXGfRr5s1KCSXHLSBlQ7OngZVXkJB/IpOXFiR2Jdx7Zmhk4MFM/d1\n" +
  "AQIDAQAB\n" +
  "-----END PUBLIC KEY-----\n",
 remote_url: "",
 salmon_url: "",
 hub_url: "",
 created_at: Mon, 02 Apr 2018 09:06:41 UTC +00:00,
 updated_at: Mon, 02 Apr 2018 09:06:41 UTC +00:00,
 note:
  "<p>A funky LDAP loving FreeBSD using swift fox who happens to also be fond of Perl, kink, transhumanism, and more.</p>",
 display_name: "VVelox",
 uri: "https://goatdaddy.net/users/vvelox",
 url: "https://goatdaddy.net/@vvelox",
 avatar_file_name: nil,
 avatar_content_type: nil,
 avatar_file_size: nil,
 avatar_updated_at: nil,
 header_file_name: nil,
 header_content_type: nil,
 header_file_size: nil,
 header_updated_at: nil,
 avatar_remote_url: nil,
 subscription_expires_at: nil,
 silenced: false,
 suspended: false,
 locked: true,
 header_remote_url: "",
 statuses_count: 11,
 followers_count: 2,
 following_count: 7,
 last_webfingered_at: Mon, 02 Apr 2018 09:06:30 UTC +00:00,
 inbox_url: "https://goatdaddy.net/users/vvelox/inbox",
 outbox_url: "https://goatdaddy.net/users/vvelox/outbox",
 shared_inbox_url: "https://goatdaddy.net/inbox",
 followers_url: "https://goatdaddy.net/users/vvelox/followers",
 protocol: "activitypub",
 id: 40753,
 memorial: false,
 moved_to_account_id: nil,
 featured_collection_url:
  "https://goatdaddy.net/users/vvelox/collections/featured",
 fields: nil,
 actor_type: nil>

ClearlyClaire commented 6 years ago

There is nothing specific to glitch-soc about this issue, and I can't reproduce it. From your log, it seems that your server knows vvelox as an ActivityPub actor, which is weird because this account does not seem to be served over ActivityPub. Maybe goatdaddy handled ActivityPub for a short while and reverted back to something OStatus-only? In any case, a downgrade from ActivityPub to OStatus does not seem currently possible in Mastodon, and I'm not sure we want to spend time implementing that as ideally, we want to get rid of OStatus at some point.

rtucker commented 6 years ago

Yeah, agreed about glitch-soc... I would have reported it directly to mainline if I could. (I'm sorta soft-banned from contributing to mainline.)

It does indeed look like a downgrade issue... I'm going to try to see if I can nuke that instance's accounts and will try again. I'll close this issue if that does the trick.

Thanks for confirming my suspicions!

rtucker commented 6 years ago

Did a Account.find(40753).delete and I can now follow it. Closing issue!