Build cache not working in Astro static projects
We have a some projects in CF Pages using the same Astro static generation project.
Even the "Build cache" is enable in every project, the build logs says its not beeing used:
I'm not sure why it cant use Build cache.
Our projects need to have some copy and move in folders in prebuild, according to the site/project that is being build. I dont know if it interferes in the build cache or whats happening.
What can i do so the build cache can be used?
10 Replies
Seems like it's failing to upload
Can you share the deployment ID?
?pages-deployment-id
The Pages deployment ID is a unique build identifier.
It's the UUID in the browser bar (for example, a URL would be
dash.cloudflare.com/ACCOUNT_ID/pages/view/PROJECT/DEPLOYMENT_ID
where the deployment ID looks something like a398d794-7322-4c97-96d9-40b5140a8d9b
).
This ID can help troubleshoot some issues with Pages builds so if you have a failing build make sure you grab that ID for the team to use.Sure!
259dfe8c-8073-439e-bafe-0d147ebc4162
Not sure why this isn't surfaced, will raise with the team:
Error: No package-lock.json, pnpm-lock.yaml, yarn.lock, or bun.lockb! Not supported
As i mentioned, our folder structure is a little bit different from Astro usual project.
We have a
astro/core
folder that contains the package.json file, and all the main project.
But we also have astro/sites/orderboomscom
folder, that is pointed as root for the project because of the wrangler.toml
with the site configurations. But inside this folder theres not a package.json initially
Just after the copy/move folders that i told about, when we move astro/core
to astro/sites/orderboomscom
then we run the Astro build command
This could be causing the Build cache fail?I forget where it looks for the file but you have a package.json but do you have a package-lock.json?
I think it should look at your configured root
Yes, i have. But not in the root, initially
We needed to change the root folder because the wrangler.toml file for each site.
Is there a different way to make the system recognizes the wrangler.toml file that is not initially inside the root folder?
not today and I'm not sure that'll be something changed anytime soon
Got it. We made a lot of tries to copy wrangler to root and start the build, but CF never recognized it, only when it was already in the root just after the clone
To facilitate the maintenance we tried to keep just one package.json to be used in every site project, but as you are saying, this file also need to be in the root folder in the very begning of the build right?
@Walshy I'm doing some tests, changed the folders structure and the root folder, but it keep failing to upload build cache. Can you check what is hapenning, please?
Here is the deployment ID: 6d695a2f-07c2-43c1-973c-99708825d9f4
ระมัวจะโดนตามกดหามยนะจะ