Comments (12)
Hi @jackey8616 thank you for the support!
Well, the strange thing is that the issue got resolved by itself after some time (24h-48h) after applyling changes from 7.0.0 release notes to all my repositories that were using connect-redis. It could be that it was some caching issue. I don't know. What's important - right now it works 👍
from connect-redis.
The issue here is your are passing the session object into connect-redis. That is no longer required and will cause this error. See the migration notes for more details:
https://github.com/tj/connect-redis/releases/tag/v7.0.0
from connect-redis.
No, I'm not passing session object to connect-redis, this line is commented out:
// const RedisStore = ConnectRedis(Session)
The problem is located here:
store: RedisStore({
client: redis
})
I'm sorry but release notes do not mention this issue. How can I address that?
Could you point out an example Typescript code which works with ioredis or share an update to the repo I've mentioned earlier?
from connect-redis.
Ahh sorry, I must have looked at the wrong commit. The issue you have with the above code is you are not initializing the constructor with new
. Should be new RedisStore({
from connect-redis.
Yes, that is also why I've commented out with new RedisStore({
as it caused different error.
RedisStore is defined as alias to a function:
(alias) function RedisStore(options: (options?: session.SessionOptions) => express.RequestHandler): s.RedisStore
(alias) namespace RedisStore
import RedisStore
The following code:
store: new RedisStore({
client: redis
}),
will cause Typescript to fail with error:
'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.ts(7009)
from connect-redis.
Hmmm.. I cannot duplicate that error with your repo locally. The errors go away when I add new
. That error makes me think you have still have the legacy @types/connect-redis installed or cached somehow.
from connect-redis.
No, I've tested it with fresh repo (I've commited the change replacing store: RedisStore({
with store: new RedisStore({
:
git clone https://github.com/hvqzao/cr-701 connect-redis-issue
cd connect-redis-issue
npm install -E
npm start
tsc
gives slightly different error than VSCode:
from connect-redis.
Following your steps on a fresh checkout I get the following errors, this is due to it missing the @types/node @types/express and @types/express-session in the package.json. However, if I install those there, I get no errors:
from connect-redis.
That didn't work on my side. I'm facing this issue on multiple projects / environments / workstations. Do you have connect-redis linked locally on your workstation via npm link
?
from connect-redis.
No link locally (I wondered the same earlier and double checked). I am running this against the published 7.0.1 release and have tried on multiple environments as well with the same result. Hmm... have you been able to replicate on say a Docker container or something so we could try the same environment? Wish I could be of more help here...
from connect-redis.
Thanks for your time. I must say I see such thing for the first time. This repo works on one workstation, but results in error mentioned above on another ¯_(ツ)_/¯. Same version of node is used. I tried to reboot, remove ~/.npm, remove package-lock, node_modules, reinstall deps. The funny thing is that when vscode complains, npm start also complains. If it works in one, it works in both. I will keep looking into that. Or future release of connect-redis will solve the feature automagically just bacause of version bump.
from connect-redis.
@hvqzao I have same issue, but solve with removed @types/connect-redis
.
I saw there is no @types/connect-redis
install in your repo.
Maybe you accidentally installed it?
from connect-redis.
Related Issues (20)
- RedisStore lacks construct signature with typescript HOT 6
- Use with fastify HOT 6
- TypeError: require(...) is not a function
- 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. HOT 1
- TypeError: Invalid argument type HOT 2
- connectRedis is not a function HOT 1
- What does the secret parameter actually do? HOT 1
- Issue with express-session HOT 1
- Support passing in `Store` class HOT 4
- Add more functions to normalized client? HOT 2
- Express Application Freeze HOT 5
- Export default build issue HOT 2
- Create a Security Policy HOT 2
- Client uses `ioredis` syntax when using `createCluster` from node-redis HOT 1
- `RedisStore` not working on TypeScript HOT 1
- Pub/Sub silently breaks the store HOT 1
- Connect-redis 7.0.0 and Redis 4.6.11 throwing "store.on is not a function" in Node v.16 HOT 10
- Type 'RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>' is not assignable to type 'Type<any> | DynamicModule | Promise<DynamicModule> | ForwardReference<any>'. HOT 6
- TypeScript CommonJS/ESM HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from connect-redis.