Accounts-facebook broken

Hi there, I ran a meteor update to 1.4.2.6, and it seems that accounts-facebook is now broken. I’m not sure if it was just coincidence, or if Facebook changed something. Looks like the “fields” paramter in the getIdentity function is throwing things off? Anyone else having this issue? Not sure how to fix…

{"line":"431","file":"oauth.js","message":"Error in OAuth Server: Failed to fetch identity from Facebook. failed [400] {\"error\":{\"message\":\"\\\"fields\\\" param is not a valid string\",\"type\":\"OAuthException\",\"code\":2500,\"fbtrace_id\":\"GcbFyVmqrLE\"}}","time":{"$date":1487000017794},"level":"warn"}
vc9p
2017-02-13 17:33:38+02:00Exception while invoking method 'login' Error: Failed to fetch identity from Facebook. failed [400] {"error":{"message":"\"fields\" param is not a valid string","type":"OAuthException","code":2500,"fbtrace_id":"GcbFyVmqrLE"}}
vc9p
2017-02-13 17:33:38+02:00 at getIdentity (packages/facebook-oauth.js:125:20)
vc9p
2017-02-13 17:33:38+02:00 at Object.handleAuthFromAccessToken (packages/facebook-oauth.js:35:18)
vc9p
2017-02-13 17:33:38+02:00 at Object.handleOauthRequest (packages/facebook-oauth.js:56:19)
vc9p
2017-02-13 17:33:38+02:00 at OAuth._requestHandlers.(anonymous function) (packages/oauth2.js:27:31)
vc9p
2017-02-13 17:33:38+02:00 at middleware (packages/oauth.js:203:5)
vc9p
2017-02-13 17:33:38+02:00 at packages/oauth.js:176:5

I’ve tried rolling back to 1.4 with no luck. Same error keeps happening. Unfortunately this has spilled over into prod, as well. It started ~6 hours ago – roughly 10am GMT. I’m wondering if something was changed on Facebook’s side.

Hi @jasongrishkoff - there are several changes coming in 1.4.3 that directly affect accounts-facebook. Are you sure you aren’t using a 1.4.3 release? I don’t believe 1.4.3 has been officially recommended yet, but it’s likely coming soon.

Long story short, a few internal packages that are used by accounts-facebook were updated (see PR’s #8261 and #8342). A side effect of these changes however is that the new facebook-oauth package had to be updated to change the way it’s building the required fields parameter (see this commit for the details). This was all tested and shown to be working though, so it’s a bit puzzling you’re seeing this error. Can you double check which version of Meteor you’re using and post back?

Hey, I literally just stumbled upon this as well:

I did indeed briefly go to 1.4.3, but rolled back to 1.4.2.6. It seems like my facebook accounts packages haven’t updated to keep with that, as they were using the older version without “.join(,)”

So… going to try suss this out from my side. Thanks for the follow-up!

When you “rolled back to 1.4.2.6”, did you also downgrade any other changes to your .meteor/packages file using your VCS (e.g. Git, SVN, etc.)?

I tried to downgrade accounts-facebook to 1.0.11, but that didn’t seem to work. I’m going to try with this in my .meteor/packages file and see if that does the trick:

accounts-facebook@1.1.0
facebook-oauth@1.3.0

I believe the specific bug that you’re encountering is solved in accounts-facebook@1.1.0 and that you will be okay if you do that.

Just to elude as to what the problem is: The url package now does some more intelligent encoding (thanks to this PR) but accounts-facebook was relying on a fairly flimsy encoding mechanism which was simply using Array.prototype.toString() when passing the data to the REST endpoint.

Frankly, the accounts-facebook should have never relied on that (undocumented) behavior, but it did. I fixed this in this commit and that is the code and behavior that you should get if you update to accounts-facebook@1.1.0).

I will note that faulty behavior would have almost certainly been exhibited if you were on accounts-facebook@1.1.0-rc.2 or accounts-facebook@1.1.0-rc.3.

2 Likes

Thanks for all the detail – it makes sense.
Importing the package @1.3.0 fixed it on prod.

Hi,

meteor add accounts-facebook@1.3.0

didn’t work for me and my version of accounts-facebook is 1.1.0 so how did you do to fix it? Why I cannot see another package versin? Is it because it is within facebook-oauth?

(for the moment I applied abernix fix in my code and it works :slight_smile: )

Thanks for your help :slight_smile:

Hello.
After updating accont-facebook package i have error on meteor startup - Exception in callback of async function: Error: Already registered the facebook OAuth service

When removing accounts-facebook - everything is ok, but how to fix this???

@stuurgurs Providing the version numbers of your Meteor and your accounts-facebook package would be very helpful in assisting you. Can you also check to see if you have any other packages with facebook in the name within your .meteor/versions or .meteor/packages files?

Meteor 1.4.2.6
After removing accounts-facebook i have no any facebook packages in .meteor/packages, but i have facebook@1.2.10 in .meteor/versions

I tried to add accounts-facebook@1.3.0 unsuccessfully

You shouldn’t try adding accounts-facebook@1.3.0 (that package doesn’t exist, but I think you’re confusing it with facebook-oauth@1.3.0).

Since you’re on Meteor 1.4.2.x though, you should do:

meteor add accounts-facebook@1.0.12

Which I believe might solve your problem as that is the accounts-facebook for the 1.4.2.x branch. (accounts-facebook@1.1.1 is for 1.4.3.x or higher).

Thanks. accounts-facebook@1.0.12 works correct!

1 Like

I have tried adding accounts-facebook 1.0.12 it’s adding 1.2.1 ? is it due to meteor version or due to version of accounts base thanks :pray:
Meteor version - 1.5.1
Accounts-base - 1.3.1