Closed EstebanHelpDesk closed 3 years ago
I just updated your code by passing it thru prettier and added some syntax highlighting :+1:
Whats your node version (can be found using node -v
) and whats your package.json look like? Your the second person to have ran into this issue recently but we haven't been able to replicate it 🤔
Hi. thank you for your reply.
Here is my package.json
{
"name": "session",
"version": "1.0.0",
"description": "test",
"main": "index.js",
"scripts": {
"dev": "nodemon main",
"start": "main"
},
"author": "esteban",
"license": "ISC",
"dependencies": {
"connect-mssql-v2": "^1.6.2",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"express-session": "^1.17.1",
"mssql": "^6.2.3",
"nodemon": "^2.0.4"
}
}
My node version is v12.18.3
Using the provided package.json
and main.js
, I was able to replicate. Thank you for providing that. I'll have to take a look but may not get to it right away unfortunately. @bradtaniguchi if you have the opportunity to look, that'd be great otherwise, I'll make sure to get to it.
Ok, I believe I have figured out the issue. We're currently using export default Store
so for JS, we would need const MSSQLStore = require('connect-mssql-v2').default(session)
. This is not ideal. I originally thought we can change to use export const Store = ...
but that breaks default imports. I'll be looking into this further. Ignore my last commit to the fixrequire
branch as it does not actually fix the issue.
@EstebanHelpDesk issue has been resolved in latest version (1.6.3) thanks to @bradtaniguchi
I would like to thank you both!
I already updated new ".d.ts" file in my node_modules. But I have a doubt, must I return to original format?
I need to keep "patched" version of this
const MSSQLStore = require('connect-mssql-v2').default(session)
or return to original ?
const MSSQLStore = require('connect-mssql-v2').(session)
I was trying to follow all your comments, but my JS experience is almost zero.
The correct format should of always been:
const MSSQLStore = require('connect-mssql-v2')(session);
this should match the format of most other session stores for express-session
Thank you @bradtaniguchi and @JLuboff . I confirm it is running now.
Hi, first at all, i'm super new in express (also in javascript).
I'm trying to use this functionality, but I try everything and cant do it work. (everything I know :) )
I started from scratch to avoid problem with other components.
I just load dotenv, mssql, express, express-session and connect-mssql-v2
If I comment the lines associated to connect-mssql I was able to run a simple query from my poolpromise with a request and query... that part works fine. That is I know SQL config is OK.
Can you help me?
I also have some doubt about using... on a real project, I want to store some value per user/session and be able to recover this value in different situations or when I using some routes... can you add some example "for dummies"?
Sorry my english is bad.