Unable to access req.user in _app.js when Custom Server sets req.user = userId #15970
Unanswered
taylor-lindores-reeves
asked this question in
Help
Replies: 1 comment
-
What does the rest of your custom server look like? You'll need middleware passing the request to Next after your example middleware retrieving a custom user. const app = next()
const handle = app.getRequestHandler()
// other app prep
// example middleware
server.all('*', (req, res) => {
return handle(req, res)
}) Also - If you're doing client-side routing, your example |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using NextJS, Prisma, GraphQL-Yoga, Apollo Client. Currently in my custom server I have the following:
I would like to access the req.user client-side i.e. in my _app.js file I should be able to do this:
For some reason req.user is undefined. Any ideas why? I have another application with a similar stack and I have this working. However, this app it doesn't seem to work. Any help greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions