Closed diego-augusto closed 1 year ago
ELOGIN
errors are issues that cause the login to fail, but on the SQL Server side (e.g. wrong password being used or similar).
Do you have the full error message, not just the error code?
This is a custom logger file... catched by SequelizeJS
tcom
is my app username
{ "date": "2020-04-14T15:22:08.905Z", "message": "Login failed for user 'tcom'.", "name": "SequelizeAccessDeniedError", "original": { "code": "ELOGIN", "message": "Login failed for user 'tcom'.", "stack": "ConnectionError: Login failed for user 'tcom'.\n at ConnectionError (node_modules\\tedious\\lib\\errors.js:13:12)\n at Parser.tokenStreamParser.on.token (node_modules\\tedious\\lib\\connection.js:848:51)\n at Parser.emit (events.js:182:13)\n at Parser.parser.on.token (node_modules\\tedious\\lib\\token\\token-stream-parser.js:37:14)\n at Parser.emit (events.js:182:13)\n at addChunk (node_modules\\tedious\\node_modules\\readable-stream\\lib\\_stream_readable.js:298:12)\n at readableAddChunk (node_modules\\tedious\\node_modules\\readable-stream\\lib\\_stream_readable.js:280:11)\n at Parser.Readable.push (node_modules\\tedious\\node_modules\\readable-stream\\lib\\_stream_readable.js:241:10)\n at Parser.Transform.push (node_modules\\tedious\\node_modules\\readable-stream\\lib\\_stream_transform.js:139:32)\n at doneParsing (node_modules\\tedious\\lib\\token\\stream-parser.js:122:14)\n at data (node_modules\\tedious\\lib\\token\\infoerror-token-parser.js:48:5)\n at call.lineNumber (node_modules\\tedious\\lib\\token\\infoerror-token-parser.js:21:19)\n at awaitData (node_modules\\tedious\\lib\\token\\stream-parser.js:221:7)\n at Parser.awaitData (node_modules\\tedious\\lib\\token\\stream-parser.js:145:7)\n at Parser.readUInt32LE (node_modules\\tedious\\lib\\token\\stream-parser.js:218:10)\n at parser.readBVarChar.procName (node_modules\\tedious\\lib\\token\\infoerror-token-parser.js:20:90)\n at readBuffer.data (node_modules\\tedious\\lib\\token\\stream-parser.js:379:9)\n at awaitData (node_modules\\tedious\\lib\\token\\stream-parser.js:371:7)\n at Parser.awaitData (node_modules\\tedious\\lib\\token\\stream-parser.js:145:7)\n at Parser.readBuffer (node_modules\\tedious\\lib\\token\\stream-parser.js:368:10)\n at readUInt8.length (node_modules\\tedious\\lib\\token\\stream-parser.js:378:12)\n at awaitData (node_modules\\tedious\\lib\\token\\stream-parser.js:165:7)" }, "parent": { "code": "ELOGIN", "message": "Login failed for user 'tcom'.", "stack": "ConnectionError: Login failed for user 'tcom'.\n at ConnectionError (node_modules\\tedious\\lib\\errors.js:13:12)\n at Parser.tokenStreamParser.on.token (node_modules\\tedious\\lib\\connection.js:848:51)\n at Parser.emit (events.js:182:13)\n at Parser.parser.on.token (node_modules\\tedious\\lib\\token\\token-stream-parser.js:37:14)\n at Parser.emit (events.js:182:13)\n at addChunk (node_modules\\tedious\\node_modules\\readable-stream\\lib\\_stream_readable.js:298:12)\n at readableAddChunk (node_modules\\tedious\\node_modules\\readable-stream\\lib\\_stream_readable.js:280:11)\n at Parser.Readable.push (node_modules\\tedious\\node_modules\\readable-stream\\lib\\_stream_readable.js:241:10)\n at Parser.Transform.push (node_modules\\tedious\\node_modules\\readable-stream\\lib\\_stream_transform.js:139:32)\n at doneParsing (node_modules\\tedious\\lib\\token\\stream-parser.js:122:14)\n at data (node_modules\\tedious\\lib\\token\\infoerror-token-parser.js:48:5)\n at call.lineNumber (node_modules\\tedious\\lib\\token\\infoerror-token-parser.js:21:19)\n at awaitData (node_modules\\tedious\\lib\\token\\stream-parser.js:221:7)\n at Parser.awaitData (node_modules\\tedious\\lib\\token\\stream-parser.js:145:7)\n at Parser.readUInt32LE (node_modules\\tedious\\lib\\token\\stream-parser.js:218:10)\n at parser.readBVarChar.procName (node_modules\\tedious\\lib\\token\\infoerror-token-parser.js:20:90)\n at readBuffer.data (node_modules\\tedious\\lib\\token\\stream-parser.js:379:9)\n at awaitData (node_modules\\tedious\\lib\\token\\stream-parser.js:371:7)\n at Parser.awaitData (node_modules\\tedious\\lib\\token\\stream-parser.js:145:7)\n at Parser.readBuffer (node_modules\\tedious\\lib\\token\\stream-parser.js:368:10)\n at readUInt8.length (node_modules\\tedious\\lib\\token\\stream-parser.js:378:12)\n at awaitData (node_modules\\tedious\\lib\\token\\stream-parser.js:165:7)" }, "stack": "SequelizeAccessDeniedError: Login failed for user 'tcom'.\n at Promise.catch.error (node_modules\\sequelize\\lib\\dialects\\mssql\\connection-manager.js:137:17)\n at tryCatcher (node_modules\\bluebird\\js\\release\\util.js:16:23)\n at Promise._settlePromiseFromHandler (node_modules\\bluebird\\js\\release\\promise.js:547:31)\n at Promise._settlePromise (node_modules\\bluebird\\js\\release\\promise.js:604:18)\n at Promise._settlePromise0 (node_modules\\bluebird\\js\\release\\promise.js:649:10)\n at Promise._settlePromises (node_modules\\bluebird\\js\\release\\promise.js:725:18)\n at _drainQueueStep (node_modules\\bluebird\\js\\release\\async.js:93:12)\n at _drainQueue (node_modules\\bluebird\\js\\release\\async.js:86:9)\n at Async._drainQueues (node_modules\\bluebird\\js\\release\\async.js:102:5)\n at Immediate.Async.drainQueues (node_modules\\bluebird\\js\\release\\async.js:15:14)\n at Immediate.args.(anonymous function) [as _onImmediate] (C:\\Users\\adminlsdb\\AppData\\Roaming\\npm\\node_modules\\pm2\\node_modules\\event-loop-inspector\\index.js:138:29)\n at runCallback (timers.js:705:18)\n at tryOnImmediate (timers.js:676:5)\n at processImmediate (timers.js:658:5)" }
There could be multiple issues causing this, but for security reasons SQL Server is only sending back the "Login failed for user '...'" message (so as to not give detailed information to potential bad actors).
According to https://support.microsoft.com/en-my/help/555332/login-failed-for-user-error-message-when-you-log-on-to-sql-server, you should check the SQL Server log for additional error information. This should help you to pinpoint exactly what is causing this error to happen for you.
Please let us know if you find out! 🙇♂️
Thanks @arthurschreiber, I was see the logs and this helped me to identify some problems on my database configuration. I cannot say if my problem is solved (as a I said, it's not deterministc), but this is the way.
In the logs, i have the follow error:
Login failed for user 'xxx'. Reason: Failed to open the explicity specified database 'xxx'. Error: 18456, Severity: 14, State: 38.
I just google it for this and change some things in my database.
At the moment, I'm just waiting if will occurs again.
this can also be caused by the login credentials not having access to the destination database on the server, check in ms Sql that the user account used, has the access you require on the target database.
In the source code I can see four moments where the this exception is throwed.
My problem is... Sometimes i recived this error 'ELOGIN', that is not deterministc.
My configuration are:
{ server: 'localhost', authentication: { options: { type: 'default', userName: 'user', password: 'password', } }, options: { trustServerCertificate: true, database: 'database' } }