Comments (7)
Closing this since it is fixed now.
from connect-redis.
I am not familiar with Apollo and what it may do the the request objects but a cursory view of your code would suggest me that somehow the express middleware and the Apollo resolvers are not sharing the same request object. If you provide a minimal example that runs and demonstrates the issue, I can take a further look.
from connect-redis.
I am not familiar with Apollo and what it may do the the request objects but a cursory view of your code would suggest me that somehow the express middleware and the Apollo resolvers are not sharing the same request object. If you provide a minimal example that runs and demonstrates the issue, I can take a further look.
Thank you for the quick response! :) I've uploaded a running repo: https://github.com/ElectronicBeef/Reddit-Clone
from connect-redis.
@ElectronicBeef Unfortunately, this isn't really runnable for me. It requires a postgres database to start the project. Is there any more minimal version that only has an external Redis dependency that demonstrates the issue?
from connect-redis.
@ElectronicBeef Unfortunately, this isn't really runnable for me. It requires a postgres database to start the project. Is there any more minimal version that only has an external Redis dependency that demonstrates the issue?
Sorry, my bad! I've created a new minimalistic repo that doesn't require a postgres database: https://github.com/ElectronicBeef/connect-redis-session-issue
from connect-redis.
I can run this, thx. In your example, the req
object is undefined in your resolver so session
is also undefined as a result. Seems like those context values aren't even making it to the resolver:
@Resolver()
export class Hello {
@Query(() => String)
hello(@Ctx("req") { req }: MyContext) {
console.log(req) // <-- this is undefined
// ...
}
from connect-redis.
I can run this, thx. In your example, the
req
object is undefined in your resolver sosession
is also undefined as a result. Seems like those context values aren't even making it to the resolver:@Resolver() export class Hello { @Query(() => String) hello(@Ctx("req") { req }: MyContext) { console.log(req) // <-- this is undefined // ... }
Thanks for the hunch in the right direction, I finally fixed it and the error may be slightly embarrassing. I just had to change the code for my context from this:
expressMiddleware(apolloServer, { context: async ({ req }) => ({ req }), })
To this:
expressMiddleware(apolloServer, { context: async ({ req }) => ({ req: req.session }), })
from connect-redis.
Related Issues (20)
- Save session as JSON HOT 2
- this.client.del is not a function HOT 1
- when redis is down middleware is hanging HOT 7
- can this module connect to redis 7 ? HOT 6
- "disableTouch" not working as intended to stop TTL reset HOT 2
- Redis client pool HOT 1
- update readme for v7 and error management HOT 4
- `express-session` as a dependency/peerDependency is missing HOT 3
- Issue with cjs and jest HOT 17
- Issue with connect-redis and redis compatibility HOT 3
- RedisStore lacks construct signature with typescript HOT 6
- Unable to upgrade [email protected] to [email protected] [typescript] HOT 12
- 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
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.