hoangvvo / nextjs-mongodb-app

A Next.js and MongoDB web application, designed with simplicity for learning and real-world applicability in mind.
https://nextjs-mongodb.now.sh/
MIT License
1.53k stars 286 forks source link

API resolved without sending a response for session #153

Open amhassen97 opened 1 year ago

amhassen97 commented 1 year ago

Hi

Love the ease of use of the next-connect and next-session libraries!

I am using the setup in this example with Passport, next-connect and next-session , with a MongoDB session store, to set up the authentication for my NextJS app.

However, as soon as I add the session middleware in the auths array i.e. :

const auths = [session, passport.initialize(), passport.session()];,

I continuously get the 'API resolved without sending a response' warning from NextJS, even though it does resolve.

When I remove the session exported variable from the array and only keep passport.initialize() and passport.session() , the warning disappears.

I cannot seem isolate the issue, as the code and structure used is practically identical to the example, with only the querying logic for the strategy being significantly changed. I have made sure all next() calls are await 'ed as mentioned in the next-connect docs, but for some or other reason the warning still appears.

Any help is greatly appreciated!

danielmeeusen commented 1 year ago

Can you post more code so I can try and reproduce the issue?

amhassen97 commented 1 year ago

I will try to create a duplicate mock repo as soon as I get a chance, just pressed for time now, thanks