I’ve got to really strange situation with the same method with same parameters working in browser and debug-mode ios app and not working in production ios app.
We’ve got a login page in our app. Before login, we call meteor method ‘canLogin’ to check if it’s deactivated user and such. The same method, with the same byte-by-byte parameters, on the same server gives different results!
We call it like this:
Meteor.call('canLogin', username, function (err, res) {
Here are relevant WebSocket transcripts. From browser, login working:
a["{\"server_id\":\"0\"}"]
["{\"msg\":\"connect\",\"version\":\"1\",\"support\":[\"1\",\"pre2\",\"pre1\"]}"]
["{\"msg\":\"method\",\"method\":\"getServerTime\",\"params\":[],\"id\":\"1\"}"]
["{\"msg\":\"method\",\"method\":\"raix:push-setuser\",\"params\":[\"jv5guPw6xJn5F5bhN\"],\"id\":\"2\"}"]
["{\"msg\":\"method\",\"method\":\"raix:push-setuser\",\"params\":[\"jv5guPw6xJn5F5bhN\"],\"id\":\"3\"}"]
["{\"msg\":\"sub\",\"id\":\"mD2EgRm7z4QD6uemH\",\"name\":\"meteor.loginServiceConfiguration\",\"params\":[]}"]
["{\"msg\":\"sub\",\"id\":\"3FZQtpGvXhHaM6krQ\",\"name\":\"_roles\",\"params\":[]}"]
["{\"msg\":\"sub\",\"id\":\"9TmbXkEAHMFpbWHZa\",\"name\":\"meteor_autoupdate_clientVersions\",\"params\":[]}"]
a["{\"msg\":\"connected\",\"session\":\"8mTjEQ3WJzxoqkhSF\"}"]
a["{\"msg\":\"added\",\"collection\":\"kadira_settings\",\"id\":\"iwvFRfbcprEk8owb8\",\"fields\":{\"appId\":\"kDY8JdfzNYdDwnag9\",\"endpoint\":\"https://meteor-apm-engine.nodechef.com\",\"clientEngineSyncDelay\":10000,\"enableErrorTracking\":true}}"]
a["{\"msg\":\"updated\",\"methods\":[\"1\"]}"]
a["{\"msg\":\"result\",\"id\":\"1\",\"result\":1543486336145}"]
a["{\"msg\":\"updated\",\"methods\":[\"2\"]}"]
a["{\"msg\":\"result\",\"id\":\"2\",\"result\":false}"]
a["{\"msg\":\"updated\",\"methods\":[\"3\"]}"]
a["{\"msg\":\"result\",\"id\":\"3\",\"result\":false}"]
a["{\"msg\":\"ready\",\"subs\":[\"mD2EgRm7z4QD6uemH\"]}"]
a["{\"msg\":\"ready\",\"subs\":[\"3FZQtpGvXhHaM6krQ\"]}"]
["{\"msg\":\"method\",\"method\":\"canLogin\",\"params\":[\"kormanuser\"],\"id\":\"4\"}"]
a["{\"msg\":\"updated\",\"methods\":[\"4\"]}"]
a["{\"msg\":\"result\",\"id\":\"4\",\"result\":{\"canLogin\":true}}"]
from IOS app, not working:
a["{\"server_id\":\"0\"}"]
["{\"msg\":\"connect\",\"version\":\"1\",\"support\":[\"1\",\"pre2\",\"pre1\"]}"]
["{\"msg\":\"method\",\"method\":\"getServerTime\",\"params\":[],\"id\":\"1\"}"]
["{\"msg\":\"method\",\"method\":\"raix:push-setuser\",\"params\":[\"CmrSWxxG9ovXjZJuJ\"],\"id\":\"2\"}"]
["{\"msg\":\"method\",\"method\":\"raix:push-setuser\",\"params\":[\"CmrSWxxG9ovXjZJuJ\"],\"id\":\"3\"}"]
["{\"msg\":\"method\",\"method\":\"raix:push-update\",\"params\":[{\"id\":\"CmrSWxxG9ovXjZJuJ\",\"token\":{\"apn\":\"74b17348e067b831803b3d29d4b57685919fe82f11da820034d02a5d9281fe3e\"},\"appName\":\"main\",\"userId\":null,\"metadata\":{}}],\"id\":\"4\"}"]
["{\"msg\":\"sub\",\"id\":\"6QoW9x6vPY8L6x7ix\",\"name\":\"meteor.loginServiceConfiguration\",\"params\":[]}"]
["{\"msg\":\"sub\",\"id\":\"H3LMDRNpWbjfFnfhm\",\"name\":\"_roles\",\"params\":[]}"]
["{\"msg\":\"sub\",\"id\":\"sBTjnhd39XADu5XmS\",\"name\":\"meteor_autoupdate_clientVersions\",\"params\":[\"zivmvxxessdgg1xu8kc5\"]}"]
a["{\"msg\":\"connected\",\"session\":\"XtSzWPcGxBkvApeko\"}"]
a["{\"msg\":\"added\",\"collection\":\"kadira_settings\",\"id\":\"XGDnEbRL7qw9r6FMK\",\"fields\":{\"appId\":\"kDY8JdfzNYdDwnag9\",\"endpoint\":\"https://meteor-apm-engine.nodechef.com\",\"clientEngineSyncDelay\":10000,\"enableErrorTracking\":true}}"]
a["{\"msg\":\"updated\",\"methods\":[\"1\"]}"]
a["{\"msg\":\"result\",\"id\":\"1\",\"result\":1543477070703}"]
a["{\"msg\":\"updated\",\"methods\":[\"2\"]}"]
a["{\"msg\":\"result\",\"id\":\"2\",\"result\":true}"]
a["{\"msg\":\"updated\",\"methods\":[\"3\"]}"]
a["{\"msg\":\"result\",\"id\":\"3\",\"result\":true}"]
a["{\"msg\":\"updated\",\"methods\":[\"4\"]}"]
a["{\"msg\":\"result\",\"id\":\"4\",\"result\":{\"_id\":\"CmrSWxxG9ovXjZJuJ\",\"token\":{\"apn\":\"74b17348e067b831803b3d29d4b57685919fe82f11da820034d02a5d9281fe3e\"},\"appName\":\"main\",\"userId\":null,\"enabled\":true,\"createdAt\":{\"$date\":1543444607954},\"updatedAt\":{\"$date\":1543444616463}}}"]
["{\"msg\":\"method\",\"method\":\"canLogin\",\"params\":[\"kormanuser\"],\"id\":\"5\"}"]
a["{\"msg\":\"updated\",\"methods\":[\"5\"]}"]
a["{\"msg\":\"result\",\"id\":\"5\",\"result\":{\"canLogin\":false,\"reason\":\"User not found\"}}"]
The only differences are raix:push
methods.
I’ve checked canLogin
calls byte-to-byte, the only difference is the method number. 4 in browser, 5 in app.
The method in question is pretty simple:
canLogin(username) {
check(username, String)
// check(password, String)
const user = Meteor.users.findOne({ username })
if (!user) {
return {
canLogin: false,
reason: 'User not found'
}
}
//...
}
What can cause this really strange error?
One more clue: it’s failing only for new users (created recently).
Total users count is 3000+.
I’ll dig into db differences now but i really cannot understand how the method can work in one browser and don’t work in another (ios app).