tedious: Request Error on input parameters

–EDIT-- See the tedious version on a comment below

When writing and executing a query, a SELECT statement without any parameters (i.e., ‘SELECT * FROM table’, or ‘SELECT column1, column2 FROM table’) works without issue. If I modify this statement to have a WHERE clause, with or without a parameter, it timesout on ‘RequestError: Failed to cancel request in 5000ms’. The code:

const sql = require('mssql');
let users = {};
const config = {
    server: 'server',
    authentication: {
        type: 'default',
        options: {
            userName: 'user',
            password: 'password'  
        }}
};
sql.connect(config).then(pool => {
    let query = 'SELECT column FROM table WHERE Term = @term';
    return pool.request()
       .input('term', sql.Int, 1)
       .query(query)
}).then(result =>{
    users = result;
    sql.close();
    console.log(users);
}).catch(err =>{
    console.log(err);
});

The full error stack:

RequestError: Failed to cancel request in 5000ms
    at Request.userCallback (C:\Users\v\WebstormProjects\project\node_modules\mssql\lib\tedious\request.js:429:19)
    at Request.callback (C:\Users\v\WebstormProjects\project\node_modules\tedious\lib\request.js:56:14)
    at Connection.socketError (C:\Users\v\WebstormProjects\project\node_modules\tedious\lib\connection.js:2416:20)
    at Connection.dispatchEvent (C:\Users\v\WebstormProjects\project\node_modules\tedious\lib\connection.js:1274:15)
    at Connection.cancelTimeout (C:\Users\v\WebstormProjects\project\node_modules\tedious\lib\connection.js:1198:10)
    at Timeout._onTimeout (C:\Users\v\WebstormProjects\project\node_modules\tedious\lib\connection.js:1162:14)
    at listOnTimeout (internal/timers.js:531:17)
    at processTimers (internal/timers.js:475:7) {
  code: 'ETIMEOUT',
  originalError: ConnectionError: Failed to cancel request in 5000ms
      at ConnectionError (C:\Users\v\WebstormProjects\project\node_modules\tedious\lib\errors.js:13:12)
      at Connection.cancelTimeout (C:\Users\v\WebstormProjects\project\node_modules\tedious\lib\connection.js:1198:67)
      at Timeout._onTimeout (C:\Users\v\WebstormProjects\project\node_modules\tedious\lib\connection.js:1162:14)
      at listOnTimeout (internal/timers.js:531:17)
      at processTimers (internal/timers.js:475:7) {
    message: 'Failed to cancel request in 5000ms',
    code: 'ETIMEOUT'
  },
  name: 'RequestError',
  number: 'ETIMEOUT',
  state: undefined,
  precedingErrors: []
}

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 40 (20 by maintainers)

Most upvoted comments

Whoops, my bad, I have both open 😛 sorry and thanks

@IanChokS the best part is that i didn’t even restart it, it was in sleep mode this whole time. Ah, computers 😃

You can try to do git clone git@github.com:tediousjs/tedious.git

Then cd tedious -> npm i -> npm run build -> npm run test-all (To see if any current tests fail)

Yep. That’s why I’m saying, it seems I have 8.0.1 with old code. Which I have no clue how it happened, but at this point I just want to resolve it. Is there any alternative to installing from npm?

Hi @snekxer, the behavior seems reproducible by using your script and the query with a parameter. Currently try to dig into this, see why the driver behaves like this.