We_Go
We_Go

Reputation: 35

Astro Project Renders Blank Page on Cloudflare with No Console Errors

Problem Description I've completed my Astro project and it works fine locally in both development and build modes. However, when I deploy it to Cloudflare, I'm getting a blank page with no console errors. What I've Tried

Created a custom index.astro and layout without components, which works. When I add components, the component doesn't render.

Project Details

Using Astro with SSR (Server-Side Rendering) Deploying to Cloudflare here is the astro.config.mjs file


import cloudflare from "@astrojs/cloudflare";

import react from "@astrojs/react";

import icon from "astro-icon";

import tailwind from "@astrojs/tailwind";

// https://astro.build/config
export default defineConfig({
  output: "server",
  adapter: cloudflare({
    platformProxy: {
      enabled: true,
    },
  }),

  integrations: [
    react(),
    icon(),
    tailwind({
      applyBaseStyles: false,
    }),
  ],
});

Questions

Why might my components fail to render on Cloudflare while working locally? Are there any known issues with Astro SSR on Cloudflare? What debugging steps can I take to identify the problem, given that there are no console errors?

Upvotes: 0

Views: 183

Answers (1)

maksim kudritsky
maksim kudritsky

Reputation: 43

I had the same error, my problem was in .env variables. Cloudflare isn't working well with them. Solution was:

  adapter: cloudflare(),
  vite: {
    define: {
        "process.env": process.env
    }
  }

Upvotes: 0

Related Questions