avitorio / outstatic

Outstatic - A static CMS for Next.js
https://Outstatic.com
MIT License
2.67k stars 157 forks source link

Issue building on vercel #51

Closed ashfn closed 1 year ago

ashfn commented 1 year ago

Hey there. Works fine on localhost but on vercel I get thig error - ```

{ -- 20:06:57.747 | getDocumentPaths: Error: ENOENT: no such file or directory, scandir '/vercel/path0/outstatic/content/posts' 20:06:57.747 | at Object.readdirSync (node:fs:1405:3) 20:06:57.747 | at _ (/vercel/path0/node_modules/outstatic/dist/utils/server.js:1:1483) 20:06:57.747 | at getStaticPaths (/vercel/path0/.next/server/pages/post/[slug].js:106:82) 20:06:57.747 | at buildStaticPaths (/vercel/path0/node_modules/next/dist/build/utils.js:586:37) 20:06:57.747 | at /vercel/path0/node_modules/next/dist/build/utils.js:721:121 20:06:57.747 | errno: -2, 20:06:57.747 | syscall: 'scandir', 20:06:57.747 | code: 'ENOENT', 20:06:57.747 | path: '/vercel/path0/outstatic/content/posts' 20:06:57.747 | } 20:06:57.748 | }


I have all the needed environment variables, any ideas?
ashfn commented 1 year ago

Update: It also happens building locally.

[ ] info - Generating static pages (0/9){ readMdMdxFiles: Error: ENOENT: no such file or directory, scandir '/home/auth/site/Portfolio/outstatic/content/Posts' at Object.readdirSync (node:fs:1451:3) at O (/home/auth/site/Portfolio/node_modules/outstatic/dist/utils/server.js:1:1916) at x (/home/auth/site/Portfolio/node_modules/outstatic/dist/utils/server.js:1:920) at E (/home/auth/site/Portfolio/node_modules/outstatic/dist/utils/server.js:1:1322) at getStaticProps (/home/auth/site/Portfolio/.next/server/pages/blog.js:77:84) at renderToHTML (/home/auth/site/Portfolio/node_modules/next/dist/server/render.js:368:26) at async /home/auth/site/Portfolio/node_modules/next/dist/export/worker.js:259:36 at async Span.traceAsyncFn (/home/auth/site/Portfolio/node_modules/next/dist/trace/trace.js:79:20) { errno: -2, syscall: 'scandir', code: 'ENOENT', path: '/home/auth/site/Portfolio/outstatic/content/Posts' } }

ashfn commented 1 year ago

Sorry - it was an issue with using getPosts('') with an non existant collection.