meteor-admin
meteor-admin copied to clipboard
Service login TypeError: Cannot read property '0' of undefined
When a user logs in using a service such as Google or Facebook, meteor-admin generates an error when viewing the users collection.
TypeError: Cannot read property '0' of undefined
at render (http://localhost:3000/packages/yogiben_admin.js?hash=cbfd8ed62678a0a41dc066c81cba0b8684e0b5d4:653:23)
at http://localhost:3000/packages/aldeed_tabular.js?hash=bc7b7794bb103b791907b465681e002a4720ee3d:1334:12
at Object.oCol.fnGetData (http://localhost:3000/packages/aldeed_tabular.js?hash=bc7b7794bb103b791907b465681e002a4720ee3d:820:5)
at _fnGetCellData (http://localhost:3000/packages/aldeed_tabular.js?hash=bc7b7794bb103b791907b465681e002a4720ee3d:1227:28)
at _fnCreateTr (http://localhost:3000/packages/aldeed_tabular.js?hash=bc7b7794bb103b791907b465681e002a4720ee3d:1809:22)
at _fnAddData (http://localhost:3000/packages/aldeed_tabular.js?hash=bc7b7794bb103b791907b465681e002a4720ee3d:1152:4)
at _fnAjaxUpdateDraw (http://localhost:3000/packages/aldeed_tabular.js?hash=bc7b7794bb103b791907b465681e002a4720ee3d:2817:4)
at http://localhost:3000/packages/aldeed_tabular.js?hash=bc7b7794bb103b791907b465681e002a4720ee3d:2662:6
at callback (http://localhost:3000/packages/aldeed_tabular.js?hash=bc7b7794bb103b791907b465681e002a4720ee3d:2554:4)
at jQuery.ajax (http://localhost:3000/packages/aldeed_tabular.js?hash=bc7b7794bb103b791907b465681e002a4720ee3d:15712:7) undefined
The issue is return value[0].address at marker //192
columns: _.union([ // 172
{ //
data: '_id', // 184
title: 'Admin', // 184
createdCell: function(node, cellData, rowData) { // 184
return $(node).html(Blaze.toHTMLWithData(Template.adminUsersIsAdmin, { //
_id: cellData // 189
})); //
}, //
width: '40px' // 184
}, { //
data: 'emails', // 192
title: 'Email', // 192
render: function(value) { // 192
return value[0].address; //
}, //
searchable: true // 192
}, { //
data: 'emails', // 199
title: 'Mail', // 199
createdCell: function(node, cellData, rowData) { // 199
return $(node).html(Blaze.toHTMLWithData(Template.adminUsersMailBtn, { //
emails: cellData // 204
})); //
}, //
width: '40px' // 199
}, { //
data: 'createdAt', // 207
title: 'Joined' // 207
} //
], adminEditDelButtons),
Here is a look at the user data from a Google login:
"_id" : "vxP...StGgb",
"createdAt" : ISODate("..."),
"services" :
{
"google" :
{
"accessToken" : "ya2...QfQ",
"idToken" : "eyJ...GLg",
"expiresAt" : 14...29,
"scope" : [ "...", "..." ],
"id" : "10...0",
"email" : "[email protected]",
"verified_email" : true,
"name" : "Some User",
"given_name" : "First",
"family_name" : "Last",
"picture" : ".../photo.jpg",
"locale" : "en"
},
"resume" :
{
"loginTokens" : [ { "when" : ISODate("..."), "hashedToken" : "uJo...hN7ow=" } ]
}
},
"profile" :
{
"name" : "First Last",
"otherField" : false
}
did you ever figure out how to fix this? It occurs on my users page, and wont display the users.