JLuboff / connect-mssql-v2

MS SQL Server session store for Express Session
MIT License
5 stars 7 forks source link

MSSQLStore is not a constructor error #47

Closed belo32 closed 3 years ago

belo32 commented 3 years ago

When implementing the example from the usage section in the Readme. I get the following error in the command line:

const store = new MSSQLStore(config, options) TypeError: MSSQLStore is not a constructor

belo32 commented 3 years ago

so I was able to get it to work but I had to instantiate by calling new MSSQLStore.default(config, options)

bradtaniguchi commented 3 years ago

How did you import MSSQLStore in your file initially?

My guess is you used:

import MSSQLStore from 'connect-mssql-v2';

except, it would appear as though the default import wasn't setup as expected, hence why you where able to gain access using .default

JLuboff commented 3 years ago

Weird, I know we had this issue before and I thought we had resolved it. I'm guessing you're using Javascript and not Typescript so you're using the require statement, not import, is that correct?

belo32 commented 3 years ago

Yes that's correct I'm using the require statement.

bradtaniguchi commented 3 years ago

@belo32 what version of node and this package are you using together? Getting a reproduction will help with debugging 👍🏼

(also sorry for slow/late reply)

belo32 commented 3 years ago

No problem, I'm using node v14.17.3 and v2.0.2 of connect-msql-v2

On Fri, Aug 13, 2021 at 5:30 PM Brad @.***> wrote:

@belo32 https://github.com/belo32 what version of node and this package are you using together? Getting a reproduction will help with debugging 👍🏼

(also sorry for slow/late reply)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JLuboff/connect-mssql-v2/issues/47#issuecomment-898730061, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJVVKXCEVOLC6EZ5R4L3RDT4WFH5ANCNFSM5BUJC6ZQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

-- http://about.me/bilal.alhajjar

alinaugustin commented 3 years ago

Same problem for me, node: v16.7.0 and "connect-mssql-v2": "^2.0.2". TypeError: The "config.options.database" property must be of type string. at new Connection (C:\Users\Alin\Desktop\jwt-cookies\node_modules\tedious\lib\connection.js:411:17) at C:\Users\Alin\Desktop\jwt-cookies\node_modules\mssql\lib\tedious\connection-pool.js:61:23 at new Promise () at ConnectionPool._poolCreate (C:\Users\Alin\Desktop\jwt-cookies\node_modules\mssql\lib\tedious\connection-pool.js:12:12) at ConnectionPool._connect (C:\Users\Alin\Desktop\jwt-cookies\node_modules\mssql\lib\base\connection-pool.js:175:10) at C:\Users\Alin\Desktop\jwt-cookies\node_modules\mssql\lib\base\connection-pool.js:147:19 at new Promise () at ConnectionPool.connect (C:\Users\Alin\Desktop\jwt-cookies\node_modules\mssql\lib\base\connection-pool.js:146:12) at MSSQLStore.initializeDatabase (C:\Users\Alin\Desktop\jwt-cookies\node_modules\connect-mssql-v2\dist\src\store.js:41:39) at MSSQLStore.ready (C:\Users\Alin\Desktop\jwt-cookies\node_modules\connect-mssql-v2\dist\src\store.js:51:28) node:internal/process/promises:246 triggerUncaughtException(err, true / fromPromise /); ^

TypeError: The "config.options.database" property must be of type string. at new Connection (C:\Users\Alin\Desktop\jwt-cookies\node_modules\tedious\lib\connection.js:411:17) at C:\Users\Alin\Desktop\jwt-cookies\node_modules\mssql\lib\tedious\connection-pool.js:61:23 at new Promise () at ConnectionPool._poolCreate (C:\Users\Alin\Desktop\jwt-cookies\node_modules\mssql\lib\tedious\connection-pool.js:12:12) at ConnectionPool._connect (C:\Users\Alin\Desktop\jwt-cookies\node_modules\mssql\lib\base\connection-pool.js:175:10) at C:\Users\Alin\Desktop\jwt-cookies\node_modules\mssql\lib\base\connection-pool.js:147:19 at new Promise () at ConnectionPool.connect (C:\Users\Alin\Desktop\jwt-cookies\node_modules\mssql\lib\base\connection-pool.js:146:12) at MSSQLStore.initializeDatabase (C:\Users\Alin\Desktop\jwt-cookies\node_modules\connect-mssql-v2\dist\src\store.js:41:39) at MSSQLStore.ready (C:\Users\Alin\Desktop\jwt-cookies\node_modules\connect-mssql-v2\dist\src\store.js:51:28)

JLuboff commented 3 years ago

@belo32 @alinaugustin v3.0.0 is live on NPM. This should resolve the issue. Please let me know if you have any further trouble. I'm going to close this issue for now.