Internal server error in Meteor.loginWithFacebook

Hello friends, I’m pretty new at Meteor.

I played a bit with this repo https://github.com/ciprian88m/meteor-1.3-social-network and I try to add a login through Facebook, but get the following error: “Internal server error”.

Here is my code:

signup.js:

     `Template.signup.events({
        'click #at-facebook': function(event, collback, response) {
           Meteor.loginWithFacebook({
     requestPermissions: ['email', 'public_profile', 'user_friends']
  }, function(error){
     if (error)
         console.log(error);
     else
         Router.go('/chat');
  });
  },

  'click #at-google': function(event, collback, response) {
        Meteor.loginWithGoogle({}, function(error) {
              if(error) {
                  throw new Meteor.Error('Facebook login failed: ', error);
              }
          });
      }
});`

accounts.js:

`AccountsTemplates.configure({
  postSignUpHook: (userId, info) => {
     let fullName = `${info.profile.firstName} ${info.profile.lastName}`,
          dob      = new Date(info.profile.yearOfBirth, info.profile.monthOfBirth -1,     info.profile.dayOfBirth),
    user     = Meteor.users.findOne({ _id: userId });

      Meteor.users.update({ _id: userId }, {
     $set: {
      "profile.birthday": dob,
      "profile.fullName": fullName,
       "profile.meta.primaryEmail": user.emails[0].address
    }
  });
}

});

 ServiceConfiguration.configurations.remove({
   service: 'facebook'
  });

      ServiceConfiguration.configurations.insert({
     service: 'facebook',
     "appId": "***",
   "secret": "****"
   });

  ServiceConfiguration.configurations.update(
    { "service": "google" },
    {
      $set: {
        "clientId": "***",
        "secret": "***",
        loginStyle: "popup"
      }
    },
    { upsert: true }
  );
  Accounts.onCreateUser(function (options, user) {
    if (user.services.facebook) {
      user.emails = [{
        address: user.services.facebook.email
    }];
    }
    return user;
  });

`

users.js:

         ```
    let Schemas = {};

     Schemas.Meta = new SimpleSchema({
    isPublicProfile: {
   type: Boolean,
    autoValue: function () {
    if (this.isInsert) { return false; }
  }
},
 primaryEmail: { type: String, optional: true },
profileImage: { type: String, optional: true },
signedUpOn: {
  type: Date,
  autoValue: function () {
    if (this.isInsert) { return new Date(); }
    else { this.unset(); }
  }
}
 });

Schemas.UserProfile = new SimpleSchema({
 firstName:    { type: String },
lastName:     { type: String },
fullName:     { type: String, optional: true },
 gender:       { type: String, allowedValues: ['male', 'female'] },
dayOfBirth:   { type: String },
monthOfBirth: { type: String },
  yearOfBirth:  { type: String },
birthday:     { type: Date, optional: true },
 location:     { type: String, optional: true },
meta:         { type: Schemas.Meta, optional: true }
});

Schemas.Users = new SimpleSchema({
 _id: {
   type: String
 },
  username:            { type: String },
  profile:             { type: Schemas.UserProfile, optional: true },
  emails:              { type: Array },
  "emails.$":          { type: Object },
"emails.$.address":  { type: String, regEx: SimpleSchema.RegEx.Email },
  "emails.$.verified": { type: Boolean },
 services:            { type: Object, optional: true, blackbox: true },
createdAt: {
  type: Date,
autoValue: function () {
  if (this.isInsert) { return new Date(); }
  else { this.unset(); }
 }
 }
});

Meteor.users.attachSchema(Schemas.Users);

I have the same problem here, with my application which used to work, after updating from 1.2.X to 1.4.4.2.
I reproduced this behavior with a fresh app, when trying to follow the Meteor Guide on this topic. Here are the steps I followed:

  1. meteor create fbtest
  2. meteor add accounts-ui
  3. meteor add accounts-facebook
  4. meteor add facebook-config-ui
  5. add {{> loginButtons}} to the <body> tag in main.js
  6. launch the app meteor
  7. Configure the facebook app as described by the configuration popup (the instructions seems a bit outdated but I think I followed every step at the end)
  8. After trying to login, we see a red “Internal server error” in the popup.

Here are the packages versions for the above steps:

/fbtest$ cat .meteor/versions 
accounts-base@1.2.17
accounts-facebook@1.1.1
accounts-oauth@1.1.15
accounts-ui@1.1.9
accounts-ui-unstyled@1.2.1
allow-deny@1.0.5
autopublish@1.0.7
autoupdate@1.3.12
babel-compiler@6.18.2
babel-runtime@1.0.1
base64@1.0.10
binary-heap@1.0.10
blaze@2.3.2
blaze-html-templates@1.1.2
blaze-tools@1.0.10
boilerplate-generator@1.0.11
caching-compiler@1.1.9
caching-html-compiler@1.1.2
callback-hook@1.0.10
check@1.2.5
ddp@1.2.5
ddp-client@1.3.4
ddp-common@1.2.8
ddp-rate-limiter@1.0.7
ddp-server@1.3.14
deps@1.0.12
diff-sequence@1.0.7
ecmascript@0.7.3
ecmascript-runtime@0.3.15
ejson@1.0.13
es5-shim@4.6.15
facebook-config-ui@1.0.0
facebook-oauth@1.3.0
fastclick@1.0.13
geojson-utils@1.0.10
hot-code-push@1.0.4
html-tools@1.0.11
htmljs@1.0.11
http@1.2.12
id-map@1.0.9
insecure@1.0.7
jquery@1.11.10
launch-screen@1.1.1
less@2.7.9
livedata@1.0.18
localstorage@1.0.12
logging@1.1.17
meteor@1.6.1
meteor-base@1.0.4
minifier-css@1.2.16
minifier-js@2.0.0
minimongo@1.0.23
mobile-experience@1.0.4
mobile-status-bar@1.0.14
modules@0.8.2
modules-runtime@0.7.10
mongo@1.1.17
mongo-id@1.0.6
npm-mongo@2.2.24
oauth@1.1.13
oauth2@1.1.11
observe-sequence@1.0.16
ordered-dict@1.0.9
promise@0.8.8
random@1.0.10
rate-limit@1.0.8
reactive-dict@1.1.8
reactive-var@1.0.11
reload@1.1.11
retry@1.0.9
routepolicy@1.0.12
service-configuration@1.0.11
session@1.1.7
shell-server@0.2.3
spacebars@1.0.15
spacebars-compiler@1.1.2
standard-minifier-css@1.3.4
standard-minifier-js@2.0.0
templating@1.3.2
templating-compiler@1.3.2
templating-runtime@1.3.2
templating-tools@1.1.2
tracker@1.1.3
ui@1.0.13
underscore@1.0.10
url@1.1.0
webapp@1.3.15
webapp-hashing@1.0.9

Did I do something wrong ?

Any help would be appreciated, if I can’t make a simple example work, I don’t see how I’ll be able to fix my application.