Closed cykoder closed 2 years ago
hi @SamHellawell
Thanks for reporting this issue. Could you please confirm if this happens with a fresh install (remove node_modules and .next folder, then npm install) and using nextein v4.0.3?
That issue should be fixed in that version, I will also update nextein-starter. I just checked it and I missed the version upgrade.
Also, if this is still happening can you confirm the next version you are using?
Thanks again!
Hey,
Yeah same thing happens in a fresh install (first time I installed nextein I got this error). It also happens under v4.0.2 and v4.0.1
Interestingly, if i disable linting in the next build step then all works as expected - even on vercel.
Using:
"next": "12.0.5",
"nextein": "4.0.1",
I had another issue causing me to downgrade to 4.0.1 btw, but it may have been related to this/missing cache (entries is undefined, when should be array).
I just tried enabling the linter on nextein-starter and I can reproduce an error with next v12.0.10
and nextein v4.0.3
:
> Build error occurred
TypeError: Cannot read property 'map' of undefined
at metadata (/Users/elmasse/Projects/elmasse/nextein-starter/node_modules/nextein/dist/entries/metadata.js:15:18)
at async dataFilterBy (/Users/elmasse/Projects/elmasse/nextein-starter/node_modules/nextein/dist/entries/fetcher.js:34:18)
at async getStaticPaths (/Users/elmasse/Projects/elmasse/nextein-starter/.next/server/pages/[name].js:34:18)
at async buildStaticPaths (/Users/elmasse/Projects/elmasse/nextein-starter/node_modules/next/dist/build/utils.js:497:31)
at async /Users/elmasse/Projects/elmasse/nextein-starter/node_modules/next/dist/build/utils.js:640:119
at async Span.traceAsyncFn (/Users/elmasse/Projects/elmasse/nextein-starter/node_modules/next/dist/trace/trace.js:75:20) {
type: 'TypeError'
}
info - Collecting page data .%
I'll give it a look on why the linter causes this error. It seems to be a TypeError, which might be related to what you mentioned about entries being undefined while the Type system expects an Array.
Yep that's the exact error I was getting with latest nextein (didnt have yet to reproduce fully, but thats 100% it). I am not sure if disabling the linter resolves the "map of undefined" error - but it does resolve the cache file missing issue. I think ultimately, you should just not use the .next folder as it seems to break a few times over this projects life due to nextjs changes. Might make your life a bit easier.
These may be two separate errors, was just a hunch could be cache file related.
Btw, great project - just what I needed once I got it working. Also worked out of the box with https://www.npmjs.com/package/next-sitemap - might be worth adding that to the starter as its a must for indexing blogs
Yes, agreed on both statements. I wanted to avoid adding more entries to gitignore but this is a trivial thing when compared to having to understand why this is not working on certain stages.
The second issue is weird, but yet I want to understand why enabling a linter will blow the entire stack.
That project (next-sitemap) looks great. I will add it to nextein site and eventually to a blog-starter, I want to keep nextein-starter as minimal as possible since I use it to test scenarios like this issue.
@SamHellawell I published a patched version v4.0.4
please give it a try and feel free to comment or close the issue if it goes well.
Thanks again for using nextein and for taking the time and effort to report the issue!
All working locally and on vercel, thanks for the quick fix! Hope nextein gets more users, great bit of kit.
Hello!
I am encountering this bug using nextein 4 (any version) on Linux. I was able to solve it by modifying nextein to not use the .next folder for its own cache. It seems this folder gets deleted/reset during build step, as even if I make the file automatically it will compile then delete itself.
Could reproduce in the nextein-starter repo, based my project from that. Also happens on vercel. Build log: