<script>
import { actions } from "astro:actions";
const button = document.getElementById("increment");
button?.addEventListener("click", async () => {
const { data, error } = await actions.addStar();
console.log(data, error);
});
</script>
Gives
$ astro dev
09:27:24 [@astrojs/cloudflare] Enabling image processing with Cloudflare Images for production with the "IMAGES" Images binding.
09:27:24 [@astrojs/cloudflare] Enabling sessions with Cloudflare KV with the "SESSION" KV binding.
09:27:24 [ERROR] [astro:actions] An unhandled error occurred while running the "astro:routes:resolved" hook
[ActionsWithoutServerOutputError] A server is required to create callable backend functions. To deploy routes to a server, add an adapter to your Astro config and configure your route for on-demand rendering
Hint:
Add an adapter and enable on-demand rendering: https://docs.astro.build/en/guides/on-demand-rendering/
Error reference:
https://docs.astro.build/en/reference/errors/actions-without-server-output-error/
ELIFECYCLE Command failed with exit code 1.