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.52k stars 286 forks source link

Error bei installing the boilerplate #25

Closed wortkotze closed 4 years ago

wortkotze commented 4 years ago

Hi,

I wanted to check out your boilerplate but i recieve the following errors after a fresh install

(node:7661) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'end' of undefined at next (/Users/steve/Documents/Programming/worryeater.net/worryeater_nextjs/node_modules/next-connect/lib/index.js:40:52) at next (/Users/steve/Documents/Programming/worryeater.net/worryeater_nextjs/node_modules/next-connect/lib/index.js:57:7) at Function.handle (/Users/steve/Documents/Programming/worryeater.net/worryeater_nextjs/node_modules/next-connect/lib/index.js:62:3) at connect (/Users/steve/Documents/Programming/worryeater.net/worryeater_nextjs/node_modules/next-connect/lib/index.js:2:11) at Object.apiResolver (/Users/steve/Documents/Programming/worryeater.net/worryeater_nextjs/node_modules/next/dist/next-server/server/api-utils.js:39

any ideas?

dhacquebord commented 4 years ago

i'm encountering this issue too.

There seems to be a problem with the middleware as req.db is not set in pages/api/users.js. but i haven't found a solution yet.

hoangvvo commented 4 years ago

Thanks for reporting. I will check on this ASAP.

hoangvvo commented 4 years ago

@wortkotze @dhacquebord

Hey, sorry for the trouble. This is an upstream bug in next-connect. Upgrading next-connect to the latest version will fix the issue.

tufail commented 4 years ago

below update will work


// next.config.js   
module.exports = {
  onDemandEntries: {
    // period (in ms) where the server will keep pages in the buffer
    maxInactiveAge: 25 * 1000,
    // number of pages that should be kept simultaneously without being disposed
    pagesBufferLength: 2,
  },
 pageExtensions: ['mdx', 'jsx', 'js']
}
hoangvvo commented 4 years ago

The issue seems to be resolved. Please check out the latest code. Ping me if it still persists for you guys.