elmasse / nextein

A static site generator with markdown + react for Next.js
https://nextein.elmasse.io
ISC License
898 stars 34 forks source link

TypeError: Cannot read property 'pageProps' of undefined #327

Closed afshinm closed 3 years ago

afshinm commented 3 years ago

I'm getting TypeError: Cannot read property 'pageProps' of undefined error after running nextein build && nextein export:

directory: /home/afshin/Projects/public/.next
info  - Copying "static build" directory
info  - Launching 23 workers
Creating entries...
> post--5490910df33430d3565f3f2e5a6ced9a--64ZT_9Kz6wGCebZsBKSjm.json
info  - Copying "public" directory
[==  ] info  - Exporting (1/4)Unhandled error during request: TypeError: Cannot read property 'pageProps' of undefined
    at _callee$ (/home/afshin/Projects/public/.next/serverless/pages/post.js:15813:26)
    at tryCatch (/home/afshin/Projects/public/.next/serverless/pages/post.js:43792:40)
    at Generator.invoke [as _invoke] (/home/afshin/Projects/public/.next/serverless/pages/post.js:44022:22)
    at Generator.next (/home/afshin/Projects/public/.next/serverless/pages/post.js:43847:21)
    at asyncGeneratorStep (/home/afshin/Projects/public/.next/serverless/pages/post.js:55622:24)
    at _next (/home/afshin/Projects/public/.next/serverless/pages/post.js:55644:9)
    at /home/afshin/Projects/public/.next/serverless/pages/post.js:55651:7
    at new Promise (<anonymous>)
    at /home/afshin/Projects/public/.next/serverless/pages/post.js:55640:12
    at _findPostInEntriesCache (/home/afshin/Projects/public/.next/serverless/pages/post.js:15837:34)

Error occurred prerendering page "/article/test". Read more: https://err.sh/next.js/prerender-error
TypeError: Cannot read property 'pageProps' of undefined
    at _callee$ (/home/afshin/Projects/public/.next/serverless/pages/post.js:15813:26)
    at tryCatch (/home/afshin/Projects/public/.next/serverless/pages/post.js:43792:40)
    at Generator.invoke [as _invoke] (/home/afshin/Projects/public/.next/serverless/pages/post.js:44022:22)
    at Generator.next (/home/afshin/Projects/public/.next/serverless/pages/post.js:43847:21)
    at asyncGeneratorStep (/home/afshin/Projects/publica.next/serverless/pages/post.js:55622:24)
    at _next (/home/afshin/Projects/public/.next/serverless/pages/post.js:55644:9)
    at /home/afshin/Projects/public/.next/serverless/pages/post.js:55651:7
    at new Promise (<anonymous>)
    at /home/afshin/Projects/publica.next/serverless/pages/post.js:55640:12
    at _findPostInEntriesCache (/home/afshin/Projects/public/.next/serverless/pages/post.js:15837:34)
info  - Exporting (4/4)
Error: Export encountered errors on following paths:
        /article/test
    at exportApp (/home/afshin/Projects/public/node_modules/next/dist/export/index.js:30:1103

Any idea why?

elmasse commented 3 years ago

Hey @afshinm Could you add what next version and operating system you are running?

Thanks

afshinm commented 3 years ago

I found the issue. Looks like Nextein doesn't work well when target is set to serverless. I needed this option for Netlify deployments. I'm on Linux 5.4.85-1-lts #1 SMP Mon, 21 Dec 2020 19:28:35 +0000 x86_64 GNU/Linux and Node.js v12.16.3.