Build cache not working in Astro static projects
I'm doing some tests, changed the folders structure and the root folder, but it keep failing to upload build cache.
Can anyone check whats wrong, please?
Here is the deployment ID:
6d695a2f-07c2-43c1-973c-99708825d9f4
9 Replies
Possibly related to https://discord.com/channels/595317990191398933/1388265295046774905
I'm having the same issue, did you found any fix?
After moving my project from a subdirectory straight into the root of the git it works now
Yes, exactly!
Not yet
I have a monorepo with one Astro project, that is used in multiples CF Pages projects
Each site have some config inside
astro/sites/(site)/
folder
And the Astro project is located inside astro/core/
Before, the core folder was being moved inside site's folder, because the individual wrangler.toml
file, in prebuild moment
But i made some tests, and it worked using the same wrangler.toml file for every site.
Now, site's folder is being moved inside core folder in prebuild
But it's still give build cache upload error:
This is my build setting, but build cache is not working:
I'm not sure if i understood what you mean, but i believe one CF Page project cannot see another one files.
So the build inside the folder is for the current project only.
The structure inside astro/core
is a viable Astro project, with src folder, and everything.
Only some project yaml and image files from project, are copied from astro/sites/(site)/
to astro/core/site/
in prebuild
That way Astro cand use theses files in the build
Yes! Before it had a wrangler for each site folder. But each site was a CF Page project.
And i had to change the root directory to astro/site/(site)/
folder, where was the wrangler.toml file
But i was told that to build cache works, it needed a package.json and package-lock.json in the CF Page root folder. Which i couldnt make it work, duplicating the same package file for each site.
So i changed the directory structure to this new oneHope this could help

Yes! Thats exactly the output /dist path
Apparently i cant do that, because i used a generic
name
prop in wrangler.toml
As wrangler CLI cant find the project, it prompt to create a new one
I usually deploy via Github-Cloudflare CI/CD
I see. Not sure how i could debug Build cache on Cloudflare deploy locally
Have any suggestion?
I just setted the build command on Pages Project
The deploy process is automated by CF, when a branch have a push/merge
I will try to change the name
inside wrangler.toml and start deploy locally via CLIIt seems that the deploy via CLI local was successful
But either in terminal, or in deploy log in CF panel, dont say anything about build cache


Not sure where this script config is placed.
I'm only know this setting, where i config to active automated build and deploys
And to change the build command, project root, and so


When the automated deploy is finished, it give these errors in the end
When i tried making the deployment via local CLI, as you suggested, this logs are not generated

This is a custom script where we get the
site
flag and run a Node script to copy site files to core, and make a Wordpress fetch to generate a JSON in prebuild:
"production": "cross-env SITE_NAME=$npm_config_site tsx src/tools/cloudflare.ts && tsx src/tools/prebuild.ts && astro check && astro build",
Not sure whats wrong.
In the other topic, @Walshy told me that the error was the project root didnt have any package.json, or package-lock.json: https://discord.com/channels/595317990191398933/1388265295046774905/1388267447207071785
I changed the folder structure, but build cache still not workingคุยอยู่ไหน