Node-mssql: Error Intermediate value is not a function

Created on 19 Jul 2017  路  3Comments  路  Source: tediousjs/node-mssql

Forgive me if this is a basic question. I'm a seasoned developer in other languages, but just starting with Node.js and trying to run my very first query using mssql.

I followed your Config and Async/Await example almost exactly, but I get an error
D:\NodeJS\dbtest.js:14
(async function () {
^
TypeError: (intermediate value)(intermediate value)(intermediate value)(intermediate value)(intermediate value) is not a function at Object. (D:\NodeJS\dbtest.js:
14:1)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Function.Module.runMain (module.js:605:10)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:575:3

    const sql = require('mssql');
    const config = {
        user: process.env.DB_USER,
        password: process.env.DB_PASS,
        server: process.env.DB_HOST,
        database: 'myDB',

        options:{
          encrypt: false
        }
    } 

    (async function () {
      try{
        let pool = await sql.connect(config)
        let qry_getPlayers = await pool.request()
          .query("SELECT  * FROM players p WHERE p.event_id = 5188")
        console.dir(qry_getPlayers)
      } 
      catch(err){
        console.log(err)
      } 
    })()

    sql.on('error', err => {
        console.log(err)
    })

Most helpful comment

Put the symbol ; at the end of your lines. That way Javascript has no questions about where you mean to end a command. Doing that on my end when I had the same error fixed it for me.

All 3 comments

Put the symbol ; at the end of your lines. That way Javascript has no questions about where you mean to end a command. Doing that on my end when I had the same error fixed it for me.

` const config = {
user: process.env.DB_USER,
password: process.env.DB_PASS,
server: process.env.DB_HOST,
database: 'myDB',

    options:{
      encrypt: false
    }
} ;  // insert symbol ; here`

some suggestions have been given to resolve the problem without response.

closing due to lack of response from author

Was this page helpful?
0 / 5 - 0 ratings

Related issues

agilitehub picture agilitehub  路  4Comments

jeetendra-choudhary picture jeetendra-choudhary  路  3Comments

PhantomRay picture PhantomRay  路  4Comments

MinsknBoo picture MinsknBoo  路  5Comments

danpetitt picture danpetitt  路  3Comments