Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

experimental.contentCollectionCache causes error on build #9499

Closed
1 task
mProjectsCode opened this issue Dec 22, 2023 · 6 comments · Fixed by #11553
Closed
1 task

experimental.contentCollectionCache causes error on build #9499

mProjectsCode opened this issue Dec 22, 2023 · 6 comments · Fixed by #11553
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) cached build

Comments

@mProjectsCode
Copy link

mProjectsCode commented Dec 22, 2023

Astro Info

Astro                    v4.0.7
Node                     v20.9.0
System                   Linux (x64)
Package Manager          bun (also happens with node)
Output                   static
Adapter                  none
Integrations             @astrojs/starlight
                         @astrojs/svelte

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

When enabling the content collection cache flag, my project fails to build with some import error.

Edit: Here is a picture of the error:
image

What's the expected result?

The project builds without error.

Link to Minimal Reproducible Example

https://github.com/mProjectsCode/obsidian-stats/tree/346c047c3aea51d6e69a4b80e8f7a28a54830895

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Dec 22, 2023
@Princesseuh Princesseuh added - P3: minor bug An edge case that only affects very specific usage (priority) and removed needs triage Issue needs to be triaged labels Feb 7, 2024
@raygesualdo
Copy link

Came here to file the same bug.

Astro                    v4.4.4
Node                     v20.10.0
System                   macOS (arm64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             @astrojs/tailwind
                         @astrojs/sitemap
                         astro-expressive-code

I don't have it configured at the moment, but it's happening locally in this repo: https://github.com/raygesualdo/raygesualdo.com

@dawaltconley
Copy link

I am wondering if this is related to content files having duplicate content? I was able to reproduce in a fresh Astro project like this:

  1. run npm create astro@latest and select the blog template
  2. enable the content collection cache in the astro config
  3. build any number of times (builds fine)
  4. copy src/content/first-post.md and rename it anything else (e.g. src/content/first-post-copy.md)
  5. run astro build twice

This reliably fails for me on the second build after copying a content file without changing its contents.

@techguysimon
Copy link

Any update on this? I am experiencing the same issue. @dawaltconley's theory might add up as in my situation I have events where some are recurring. In these cases the file is copied to an occurences collection with a dated filename but the same content.

@Marocco2
Copy link

I found that caching inside node_modules were unreliable. Setting a /cache folder on root project would alleviate all the issues

@techguysimon
Copy link

I found that caching inside node_modules were unreliable. Setting a /cache folder on root project would alleviate all the issues

I just tried that and I am getting the same error.

experimental: { contentCollectionCache: true }, cacheDir: './_astro_cache'

@Marocco2
Copy link

I found that caching inside node_modules were unreliable. Setting a /cache folder on root project would alleviate all the issues

I just tried that and I am getting the same error.

experimental: { contentCollectionCache: true }, cacheDir: './_astro_cache'

Clean node_modules and retry that if you haven't

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) cached build
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants