Error: Failed to publish assets.
Hi, I'm trying to evaluate Workers&Pages to move my Astro app. The build succeeds, but I get errors like this one:
I tried all configurations, modes, etc., available in the official Astro integration. All reports fail in the deployment step.
I saw that this problem was encountered repeatedly, but all were solved in the support tickets, so it would be nice to get some insight if there is a common problem with Astro or configuration or something.
Is it related to the newest version, or should I change something?
3 Replies
I recently deployed an astro (3.6.6) site with github actions and it worked great. Attached my astro config if it helps.
Thanks @dosyourself.I already migrated my app to astro@4. Due to the fact that I reached the limit of the maximum static routes, I had to change the configuration.
So I changed it in the following order:
1) Very basic config:
As a result, I got this:
Error: Failed to publish your Function. Got error: Error 8000057: Rules in
_routes.json are over the 100 rule limit.
2) Then I changed the configuration to the following one:
The log looks this way:
3..n) Any change in the configuration (imageService, mode, functionPerRoute, routes) finishes with the same error in the log.
I figured out what caused the problem.
I checked if my build can be deployed by manual (drag & drop) schema. When I clicked a button to deploy uploaded assets. I had an error pointing to a _routes.json
file. It should contain at least one rule of include
or exclude
.
It started to operate when I modified the configuration to generate those paths fitting into the max routes limit.
I hope it helps someone in the future.
Perhaps that error could be covered by a friendly error message in the CLI 🙂Awesome! I just sat down and started looking into this myself and found this in the docs:
https://docs.astro.build/en/guides/integrations-guide/cloudflare/#routesinclude
As well as PR's https://github.com/withastro/astro/pull/7846 && https://github.com/withastro/astro/pull/8459