[ASTRO] Funtion Error when trying to deploy astro site using ssr node


Site Name: cmgo-seo-preprod.netlify.app

Issue Description:

We are experiencing an error when trying to deploy our Astro site to Netlify in SSR mode. The site runs fine locally, but the deployment fails on Netlify. Below is the error message we receive in the build logs:

Jun 13, 03:14:41 PM: 84f12e0b ERROR  09:44:41 [ERROR] TypeError: (intermediate value) is not iterable
    at file:///var/task/.netlify/functions-internal/ssr/ssr.mjs:8414:28
    at async callComponentAsTemplateResultOrResponse (file:///var/task/node_modules/astro/dist/runtime/server/render/astro/render.js:90:25)
    at async renderToAsyncIterable (file:///var/task/node_modules/astro/dist/runtime/server/render/astro/render.js:132:26)
    at async renderPage (file:///var/task/node_modules/astro/dist/runtime/server/render/page.js:31:24)
    at async lastNext (file:///var/task/node_modules/astro/dist/core/render-context.js:126:25)
    at async callMiddleware (file:///var/task/node_modules/astro/dist/core/middleware/callMiddleware.js:21:10)
    at async RenderContext.render (file:///var/task/node_modules/astro/dist/core/render-context.js:149:22)
    at async App.render (file:///var/task/node_modules/astro/dist/core/app/index.js:233:18)
    at async Module.handler (file:///var/task/node_modules/@astrojs/netlify/dist/ssr-function.js:29:30)
    at async Runtime.handler (file:///var/task/___netlify-bootstrap.mjs:2:26296)

Steps to Reproduce:

  1. Deploy the Astro site using SSR mode on Netlify.
  2. The deployment fails with the above error message.

Build Configuration:

  • package.json

    {
      "name": "ssr-seo",
      "type": "module",
      "version": "0.0.1",
      "scripts": {
        "dev": "astro dev",
        "start": "astro dev",
        "build": "astro check && astro build",
        "preview": "astro preview",
        "astro": "astro"
      },
      "dependencies": {
        "@astrojs/check": "^0.7.0",
        "@astrojs/netlify": "5.2.1",
        "@astrojs/tailwind": "^5.1.0",
        "astro": "4.10.0",
        "axios": "^1.7.2",
        "sitemap": "^8.0.0",
        "tailwindcss": "^3.4.4",
        "typescript": "^5.4.5"
      }
    }
    
  • netlify.toml

    [build]
      command = "npm run build"
      publish = "dist/"
    
  • astro.config.mjs

    import { defineConfig } from "astro/config";
    import netlify from "@astrojs/netlify";
    import tailwind from "@astrojs/tailwind";
    
    // https://astro.build/config
    export default defineConfig({
      output: "server",
      adapter: netlify({ cacheOnDemandPages: true }),
      integrations: [tailwind()],
    });
    

Troubleshooting Steps Taken:

  1. Ensured that the site runs fine locally.
  2. Verified that all environment variables are correctly set.
  3. Checked for Node.js version mismatches.
  4. Enabled detailed logging to capture more information about the error.
  5. Reviewed build logs for any additional warnings or errors.

Despite these efforts, the issue persists. We suspect that the problem may be related to how Astro’s SSR mode is handled in the Netlify environment.

Request for Assistance:

Could you please help us resolve this issue? We need to ensure our site can be deployed in SSR mode without encountering this error. Any insights or suggestions would be greatly appreciated.


Do you have a reproduction we can try? From the looks of this, this looks like a bug with Astro and not Netlify. Did you try reporting it to them?