Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueryFailedError 错误x无法定位源码位置 #10819

Open
1 of 18 tasks
wcldyx opened this issue Apr 9, 2024 · 0 comments
Open
1 of 18 tasks

QueryFailedError 错误x无法定位源码位置 #10819

wcldyx opened this issue Apr 9, 2024 · 0 comments

Comments

@wcldyx
Copy link

wcldyx commented Apr 9, 2024

Issue description

SQL error cannot be pinpointed to the source code location.

Expected Behavior

I hope the error message can accurately pinpoint the location in the source code.

Actual Behavior

从以下报错无法定位到源码为 index.ts 这个文件。

ts-node .\index.ts
query failed: select * from notable
error: QueryFailedError: Error: Invalid object name 'notable'.
E:\geng_shen\Final_Salvation\ts\node_modules\mssql\lib\tedious\request.js:492
callback(error, recordsets, output, rowsAffected, recordsetcolumns)
^
QueryFailedError: Error: Invalid object name 'notable'.
at E:\geng_shen\Final_Salvation\ts\node_modules\typeorm\src\driver\sqlserver\SqlServerQueryRunner.ts:282:30
at E:\geng_shen\Final_Salvation\ts\node_modules\mssql\lib\base\request.js:440:25
at Request.userCallback (E:\geng_shen\Final_Salvation\ts\node_modules\mssql\lib\tedious\request.js:492:15)
at Request.callback (E:\geng_shen\Final_Salvation\ts\node_modules\tedious\src\request.ts:379:14)
at Parser.onEndOfMessage (E:\geng_shen\Final_Salvation\ts\node_modules\tedious\src\connection.ts:3713:22)
at Object.onceWrapper (node:events:631:28)
at Parser.emit (node:events:517:28)
at Parser.emit (node:domain:489:12)
at Readable. (E:\geng_shen\Final_Salvation\ts\node_modules\tedious\src\token\token-stream-parser.ts:30:12)
at Readable.emit (node:events:517:28) {
query: 'select * from notable',
parameters: undefined,
driverError: RequestError: Invalid object name 'notable'.
at handleError (E:\geng_shen\Final_Salvation\ts\node_modules\mssql\lib\tedious\request.js:384:15)
at Connection.emit (node:events:517:28)
at Connection.emit (node:domain:489:12)
at Connection.emit (E:\geng_shen\Final_Salvation\ts\node_modules\tedious\src\connection.ts:1902:18)
at RequestTokenHandler.onErrorMessage (E:\geng_shen\Final_Salvation\ts\node_modules\tedious\src\token\handler.ts:388:21)
at Readable. (E:\geng_shen\Final_Salvation\ts\node_modules\tedious\src\token\token-stream-parser.ts:22:55)
at Readable.emit (node:events:517:28)
at Readable.emit (node:domain:489:12)
at addChunk (node:internal/streams/readable:368:12)
at readableAddChunk (node:internal/streams/readable:341:9) {
code: 'EREQUEST',
originalError: Error: Invalid object name 'notable'.
at handleError (E:\geng_shen\Final_Salvation\ts\node_modules\mssql\lib\tedious\request.js:382:19)
at Connection.emit (node:events:517:28)
at Connection.emit (node:domain:489:12)
at Connection.emit (E:\geng_shen\Final_Salvation\ts\node_modules\tedious\src\connection.ts:1902:18)
at RequestTokenHandler.onErrorMessage (E:\geng_shen\Final_Salvation\ts\node_modules\tedious\src\token\handler.ts:388:21)
at Readable. (E:\geng_shen\Final_Salvation\ts\node_modules\tedious\src\token\token-stream-parser.ts:22:55)
at Readable.emit (node:events:517:28)
at Readable.emit (node:domain:489:12)
at addChunk (node:internal/streams/readable:368:12)
at readableAddChunk (node:internal/streams/readable:341:9) {
info: [ErrorMessageToken]
},
number: 208,
lineNumber: 1,
state: 1,
class: 16,
serverName: 'DESKTOP-RKK5N9M',
procName: '',
precedingErrors: []
},
code: 'EREQUEST',
originalError: Error: Invalid object name 'notable'.
at handleError (E:\geng_shen\Final_Salvation\ts\node_modules\mssql\lib\tedious\request.js:382:19)
at Connection.emit (node:events:517:28)
at Connection.emit (node:domain:489:12)
at Connection.emit (E:\geng_shen\Final_Salvation\ts\node_modules\tedious\src\connection.ts:1902:18)
at RequestTokenHandler.onErrorMessage (E:\geng_shen\Final_Salvation\ts\node_modules\tedious\src\token\handler.ts:388:21)
at Readable. (E:\geng_shen\Final_Salvation\ts\node_modules\tedious\src\token\token-stream-parser.ts:22:55)
at Readable.emit (node:events:517:28)
at Readable.emit (node:domain:489:12)
at addChunk (node:internal/streams/readable:368:12)
at readableAddChunk (node:internal/streams/readable:341:9) {
info: ErrorMessageToken {
name: 'ERROR',
handlerName: 'onErrorMessage',
number: 208,
state: 1,
class: 16,
message: "Invalid object name 'notable'.",
serverName: 'DESKTOP-RKK5N9M',
procName: '',
lineNumber: 1
}
},
number: 208,
lineNumber: 1,
state: 1,
class: 16,
serverName: 'DESKTOP-RKK5N9M',
procName: '',
precedingErrors: []
}

Steps to reproduce

// index.ts
import { DataSource } from "typeorm";

const dataSource = new DataSource({
  type: 'mssql',
  host: "192.168.101.27",
  port: 1433,
  username: 'sa',
  password: 'sql',
  database: 'shanxi',
  logging: ['error'],
  entities: [],
  synchronize: false,
  pool: {
    max: 50,
    min: 10,
    idleTimeoutMillis: 3000,
  },
  requestTimeout: 30000,
  options: {
    encrypt: false,
  },
})

async function main () {
  await dataSource.initialize();
 // Intentionally creating errors.
 const list = await dataSource.query('select * from notable')
 console.log(list)
}

main();

My Environment

Dependency Version
Operating System
Node.js version v18.19.0
Typescript version ^4.7.4
TypeORM version ^0.3.20

Additional Context

No response

Relevant Database Driver(s)

  • aurora-mysql
  • aurora-postgres
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • spanner
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

Yes, I have the time, and I know how to start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant