-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Empty content collection when dev is first run #12866
Comments
This is what I get when running
Here is the definition, which is the same as what is shown on the Astro "upgrade to v5"guide:
I initially thought it might be a path delimiter issue ( |
Even though I get a |
Hello @ericswpark. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with |
@florian-lefebvre as I mentioned in the OP a repro would be of no use – Astro works fine on Linux and subsequently most of the web-based platforms that presumably is Linux container-based. This appears to be a platform specific issue. |
I actually have what I believe is the same problem, but I am on Mac. My experience with the issue is documented in the discord support channel, but in summary: I cannot get a migration to v5 to work on a very simple blog because content collections are empty. I initiated a new Astro Blog template project on both IDX and Stackblitz (minimal example) and had no issue. So then I downloaded the zip file from Stackblitz to my machine, uncompressed it, did So I don't believe it's any issue with not following instructions, since it seems to work from the SB and IDX templates when used in those environments but just doesn't work locally. Finding this thread just now, I tried Again, I am on the current MacOS version, and had issues on both Node 20 and 22, and all Astro dependencies were up to date as far as I could tell. I couldn't find any other errors in browser or in VS Code. |
@ericswpark I understand it's OS specific but a repro is still useful for us because we can't take the time to replicate manually each issue. It doesn't have to be a stackblitz, a repo with the minimal conditions to reproduce your bug on windows is absolutely fine! We'll check it out on windows too |
@Gazook89 in the project downloaded locally, can you run |
@florian-lefebvre understood, I thought we could only submit web container based from the issue form. Will submit a repro repo in a second! |
@florian-lefebvre this is very weird and annoying. It appears that there is some sort of race condition going on here. I had my site repo cloned to I then re-cloned my repository to a separate directory Keep in mind that I did this several times in repo A -- deleting all generated files and dependencies and reinstalling and re-running the dev server -- and it still didn't work until today. I can try and remove the Here is a link to the minimal example repo: https://github.com/ericswpark/astro-issue-12866-repro/ |
I'm pretty sure this is a dupe of #12773. I know you've said |
@ascorbic I already tried changing to that branch with my repository and still encountered the same issue. I don't remember if I removed Feel free to close the issue -- I will comment if I ever re-run into this problem with the changes from that branch merged. |
@ascorbic I've managed to recreate the issue with the experimental branch, and believe I have proper repro instructions:
Step 3 appears to be important -- without step 3, I've tried this 4~5 times and have gotten it to reliably break on all of the attempts. Please let me know if you can reproduce this problem. EDIT: this is reproducible on both my main website repo and the minimal reproduction repo. I've updated the dependency to point to the experimental branch -- the problem still occurs. My guess is something in the build step syncs content collections in such a way that the dev server thinks it doesn't exist? This kind of explains why if I do step 4 before step 3 then subsequent dev server invocations will still show the content collection properly. |
In your repro, despite the version in the package.json it's installing 5.1.1. Try doing |
@ascorbic you're right, I missed that part. However, I finally figured out why the experimental branch broke for me as well. Try this:
Again, skipping either 2 or 3 before running 4 will result in not hitting this edge case. Once you reproduce using those steps, your After running step 4, you should get a log output like this:
|
I just woke up so haven't run through the whole thread here, but for @florian-lefebvre here is my
|
@ericswpark "Content config not loaded" is the important bit there. It means Vite can't load the content config. Do you get that in the minimal repro? |
@Gazook89 can you try with |
@ascorbic doing Here is my terminal from when i tried this with a basic blog template with no further changes after running the init script: terminal
|
@ascorbic yes, with the reproduction steps above I was able to reproduce it in the minimal repro repo as well. |
Should i be expecting to see a |
@Gazook89 if you've never seen it, probably not. I just did a |
I don't know if issues can be reopened in this repo, or if I should create a new one, but the v5.1.3 update to which #12818 was attached to hasn't resolved this issue for me. To be sure, I created a new repo, did
I changed nothing from the template. I reran Using the v5.1.3 with the Blog template on Stackblitz works fine.
|
OK, this is interesting. This doesn't occur with pnpm - just npm. It also works as soon as you first save a file. |
This isn't my experience as of a few minutes ago, as of Astro 5.1.3. I just wiped my test blog (created with the Astro Blog Template) and installed a new one. On NPM, if I do So I'm waiting for this new patch to come down the pipe to try that out, but just noting here that right now, saving a file doesn't fix the problem (for me). |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
N/A
Describe the Bug
On Windows, Astro reports an empty Content Layer collection when running the server with
npm run dev
. Using the built preview (npm run build; npm run preview
) is not affected and shows all content within the Content Layer collection. I've tested the same site on Linux and it does not suffer from this issue.What's the expected result?
Astro should show the proper content within the Content Layer collection, instead of showing nothing.
Link to Minimal Reproducible Example
N/A - platform-specific bug
Participation
The text was updated successfully, but these errors were encountered: