Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Astro SSR Firebase Hosting: An unexpected error at build step 2 during firebase deployment

Hello Everyone,

During deploying an Astro SSR site to Firebase hosting, I got an unexpected error. Before deploying, it runs without errors using "firebase serve" locally. The details are as follows.

The error message in the logs

type: "build"
}
severity: "INFO"
textPayload: "ERROR: build step 2 "europe-west1-docker.pkg.dev/serverless-runtimes/google-22-full/builder/nodejs:nodejs_20240715_RC00" failed: step exited with non-zero status: 1"

I checked the node and npm package versions with firebase CLI; node: v20.15.1, npm: 10.8.2.

The relevant configurations files:

astro.config.msj 

...

  output: "hybrid",
  experimental: {
    clientPrerender: true,
    directRenderScript: true
  },
  adapter: node({
    mode: "standalone"
  })
});
 
package.json at the project root
....
  "dependencies": {
    "@astrojs/check": "^0.8.2",
    "@astrojs/node": "^8.3.2",
    "@astrojs/sitemap": "^3.1.6",
    "@astrojs/starlight": "^0.25.1",
    "@astrojs/starlight-tailwind": "^2.0.3",
    "@astrojs/tailwind": "^5.1.0",
    "astro": "^4.12.2",
    "astro-compressor": "^0.4.1",
    "firebase": "^10.12.4",
    "firebase-admin": "^12.2.0",
    "firebase-functions": "^5.0.1",
    "firebase-tools": "^13.13.3",
    "globby": "^14.0.2",
    "gsap": "^3.12.5",
    "html-minifier-terser": "^7.2.0",
    "path-to-regexp": "^7.1.0",
    "preline": "^2.3.0",
    "sharp": "^0.32.6",
    "sharp-ico": "^0.1.5",
    "tailwindcss": "^3.4.6"
  },
  "devDependencies": {
    "@tailwindcss/forms": "^0.5.7",
    "astro-vtbot": "^1.8.2",
    "prettier": "^3.3.3",
    "prettier-plugin-astro": "^0.14.1",
    "prettier-plugin-tailwindcss": "^0.6.5",
    "typescript": "^5.5.3"
  },
....
firebase.json
{
  "hosting": {
    "source": ".",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "frameworksBackend": {
      "region": "europe-west1"
    }
  },
  "functions": [
    {
      "runtime": "nodejs20",
      "source": "functions",
      "codebase": "default",
      "ignore": [
        "node_modules",
        ".git",
        "firebase-debug.log",
        "firebase-debug.*.log",
        "*.local"
      ]
    }
  ]
}
package.json at functions folder
{
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "serve": "firebase emulators:start --only functions",
    "shell": "firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "engines": {
    "node": "20",
    "npm": ">=9.6.7"
  },
  "main": "index.js",
  "dependencies": {
    "firebase-admin": "^12.1.0",
    "firebase-functions": "^5.0.0"
  },
  "devDependencies": {
    "firebase-functions-test": "^3.1.0"
  },
  "private": true
}
 
Thank you in advance; any suggestions would be welcomed.
0 1 929
1 REPLY 1