How To Fix / Remove All Facebook Logins For Updated AppID

Due to recent fb changes, I created a new app for my forum facebook login (one that didn’t include unnecessary permissions as I had setup before).

Upon adding this and trying to login I get:
Oops
The software powering this discussion forum encountered an unexpected problem. We apologize for the inconvenience.

Detailed information about the error was logged, and an automatic notification generated. We’ll take a look at it.

No further action is necessary. However, if the error condition persists, you can provide additional detail, including steps to reproduce the error, by posting a discussion topic in the site’s feedback category.

===
Looking into the logs it seems it is trying to set a duplicate key for facebook login credentials.

ActiveRecord::RecordNotUnique (PG::UniqueViolation: ERROR: duplicate key value violates unique constraint “index_facebook_user_infos_on_user_id” …

How can I clear all of those out and get going with the new app id?

And this is maybe? a bug? - shouldn’t it overwrite this by default - like if a user changed their facebook name - or is this just an app id issue?

I’m looking into this.

1 Like

I can reproduce this. I just created a new FB login app and connected it to try.discourse.org. I can no longer log in with my FB account.

Relevant error in logs:

ActiveRecord::RecordNotUnique (PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "index_facebook_user_infos_on_user_id"
DETAIL:  Key (user_id)=(129) already exists.
: INSERT INTO "facebook_user_infos" ("user_id", "facebook_user_id", "first_name", "last_name", "email", "name", "created_at", "updated_at", "avatar_url") VALUES (129, 10215632354952089, 'Joshua', 'Rosenfeld', 'email_redacted', 'Joshua Rosenfeld', '2018-05-21 18:36:20.981945', '2018-05-21 18:36:20.981945', 'http://graph.facebook.com/v2.6/10215632354952089/picture') RETURNING "id")
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-mini-profiler-1.0.0/lib/patches/db/pg.rb:92:in `async_exec'

@sam, is this something you can fix?

4 Likes

Oh … we need to nuke all old facebook user infos when a new app is configured, I think the opening move here is just to write a howto on this, can you take that.

If you change facebook auth app

./launcher enter app
rails c
FacebookUserInfo.delete_all
6 Likes

Awesome - works like a charm. Thanks for the quick help!

1 Like

No problem. It sounds like you want a dedicated howto - any reason not to just append this to the existing howto on configuring FB login? Perhaps a “troubleshooting” section at the end?

3 Likes

I think appending this to the main howto is probably good enough for now

4 Likes

Added to Configuring Facebook login for Discourse.

3 Likes

This topic was automatically closed after 33 hours. New replies are no longer allowed.