[SOLVED] "Exception while invoking method 'login'" when using LDAP


Hi everyone!

I just set up my first RC server (v73.2) from tar on Debian 9, and I ran into a problem after setting up LDAP auth. Local logins work, but LDAP logins fail with

server.js:197 LDAPHandler ➔ info Init LDAP login <MY EMAIL>
server.js:197 LDAP ➔ Connection.info Init setup 
server.js:197 LDAP ➔ Connection.info Connecting ldap://<MY_DC>:389 
server.js:197 LDAP ➔ Connection.info Starting TLS 
server.js:197 LDAP ➔ Connection.info TLS connected 
server.js:197 LDAP ➔ Bind.info Binding UserDN <DISTINGUISHEDNAME> 
server.js:197 LDAP ➔ Search.info Searching user <MY EMAIL> 
server.js:197 LDAP ➔ Search.info Search result count 1 
server.js:197 LDAP ➔ Auth.info Authenticating <DISTINGUISHEDNAME> 
server.js:197 LDAP ➔ Search.info Search result count 5 
server.js:197 LDAP ➔ Auth.info Authenticated <DISTINGUISHEDNAME>
server.js:197 LDAPHandler ➔ info Querying user 
server.js:197 LDAPHandler ➔ info User does not exist, creating <DISTINGUISHEDNAME> 
Exception while invoking method 'login' SyntaxError: Unexpected token ` in JSON at position 49     at JSON.parse (<anonymous>)     
at getDataToSyncUserData (packages/rocketchat:ldap/server/sync.js:84:25)     
at addLdapUser (packages/rocketchat:ldap/server/sync.js:231:19)     
at MethodInvocation.<anonymous> (packages/rocketchat:ldap/server/loginHandler.js:144:17)     
at tryLoginMethod (packages/accounts-base/accounts_server.js:460:31)     
at tryLoginMethod (packages/accounts-base/accounts_server.js:1294:14)     
at AccountsServer._runLoginHandlers (packages/accounts-base/accounts_server.js:458:22)     
at AccountsServer.Accounts._runLoginHandlers (packages/rocketchat:lib/server/lib/loginErrorMessageOverride.js:7:35)     
at MethodInvocation.methods.login (packages/accounts-base/accounts_server.js:518:31)     
at MethodInvocation.methodMap.(anonymous function) (packages/rocketchat_monitoring.js:2731:30)     
at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1767:12)     
at DDP._CurrentMethodInvocation.withValue (packages/ddp-server/livedata_server.js:719:19)     
at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1304:12)     
at DDPServer._CurrentWriteFence.withValue (packages/ddp-server/livedata_server.js:717:46)     
at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1304:12)     
at Promise (packages/ddp-server/livedata_server.js:715:46)     
at new Promise (<anonymous>)     
at Session.method (packages/ddp-server/livedata_server.js:689:23)     
at packages/ddp-server/livedata_server.js:559:43 
server.js:197 LDAP ➔ Search.info Idle 
server.js:197 LDAP ➔ Connection.info Disconecting 
server.js:197 LDAP ➔ Search.info Closed 

So it seems the LDAP auth itself works, but then the local user sync/creation does not. I’m not sure where to look for further clues. Could any of you give me a hint?


[UPDATE] I found it. The stray " ` " was in User Data Field Map in LDAP -> Sync/Import.

My bad, sorry.