Skip to content

Cloud Functions fail to load: "User code failed to load. Cannot determine backend specification. Timeout after 10000" #9502

@LSSDG

Description

@LSSDG

I am unable to deploy Firebase Cloud Functions. Every deployment fails with:

Error: User code failed to load. Cannot determine backend specification.
Timeout after 10000.

This happens even with a minimal index.js and even after a complete reinstall of
Node, nvm, firebase-tools, and the functions folder.

Environment:

  • Windows 10
  • Node.js v20.19.5 (via nvm)
  • Firebase Tools 14.25.1
  • firebase-functions 7.0.0
  • firebase-admin 12.6.0

firebase.json

{
  "functions": [
    {
      "source": "functions",
      "codebase": "default",
      "runtime": "nodejs20",
      "ignore": [
        "node_modules",
        ".git",
        "firebase-debug.log",
        "firebase-debug.*.log",
        "*.local"
      ]
    }
  ],
  "hosting": {
    "public": "dist",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ],
    "headers": [
      {
        "source": "/app-ads.txt",
        "headers": [
          {
            "key": "Content-Type",
            "value": "text/plain; charset=utf-8"
          },
          {
            "key": "Cache-Control",
            "value": "public, max-age=3600"
          }
        ]
      }
    ]
  }
}

Simple index.js that still fails:

const functions = require("firebase-functions");

exports.helloWorld = functions.https.onRequest((req, res) => {
  res.send("Hello world");
});

Tests:

  • Running node -e "require('./functions/index.js')" works
  • Deploying hosting works
  • Only functions deployments fail
  • Emulator also fails with same timeout

I also tried:

  • Removing node_modules & reinstalling
  • Clearing npm cache
  • Reinstalling Firebase CLI
  • Reinstalling Node
  • Allowing firewall access
  • Removing extra firebase folders

Still the same timeout & "User code failed to load".

I will attach firebase-debug.log for reference.

[2025-11-21T17:57:49.082Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2025-11-21T17:57:49.088Z] > authorizing via signed-in user ([email protected])
[2025-11-21T17:57:49.089Z] [iam] checking project real49estate for permissions ["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]
[2025-11-21T17:57:49.096Z] Checked if tokens are valid: true, expires at: 1763750405506
[2025-11-21T17:57:49.098Z] Checked if tokens are valid: true, expires at: 1763750405506
[2025-11-21T17:57:49.168Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects/real49estate:testIamPermissions [none]
[2025-11-21T17:57:49.174Z] >>> [apiv2][(partial)header] POST https://cloudresourcemanager.googleapis.com/v1/projects/real49estate:testIamPermissions x-goog-quota-user=projects/real49estate
[2025-11-21T17:57:49.177Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/real49estate:testIamPermissions {"permissions":["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]}
[2025-11-21T17:57:51.041Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects/real49estate:testIamPermissions 200
[2025-11-21T17:57:51.043Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/real49estate:testIamPermissions {"permissions":["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]}
[2025-11-21T17:57:51.046Z] Checked if tokens are valid: true, expires at: 1763750405506
[2025-11-21T17:57:51.048Z] Checked if tokens are valid: true, expires at: 1763750405506
[2025-11-21T17:57:51.050Z] >>> [apiv2][query] POST https://iam.googleapis.com/v1/projects/real49estate/serviceAccounts/[email protected]:testIamPermissions [none]
[2025-11-21T17:57:51.053Z] >>> [apiv2][body] POST https://iam.googleapis.com/v1/projects/real49estate/serviceAccounts/[email protected]:testIamPermissions {"permissions":["iam.serviceAccounts.actAs"]}
[2025-11-21T17:57:51.622Z] <<< [apiv2][status] POST https://iam.googleapis.com/v1/projects/real49estate/serviceAccounts/[email protected]:testIamPermissions 200
[2025-11-21T17:57:51.625Z] <<< [apiv2][body] POST https://iam.googleapis.com/v1/projects/real49estate/serviceAccounts/[email protected]:testIamPermissions {"permissions":["iam.serviceAccounts.actAs"]}

=== Deploying to 'real49estate'...

i  deploying functions
[2025-11-21T17:57:51.656Z] Checked if tokens are valid: true, expires at: 1763750405506
[2025-11-21T17:57:51.657Z] Checked if tokens are valid: true, expires at: 1763750405506
[2025-11-21T17:57:51.660Z] >>> [apiv2][query] GET https://cloudresourcemanager.googleapis.com/v1/projects/real49estate [none]
[2025-11-21T17:57:52.021Z] <<< [apiv2][status] GET https://cloudresourcemanager.googleapis.com/v1/projects/real49estate 200
[2025-11-21T17:57:52.023Z] <<< [apiv2][body] GET https://cloudresourcemanager.googleapis.com/v1/projects/real49estate {"projectNumber":"448205226195","projectId":"real49estate","lifecycleState":"ACTIVE","name":"realestate","labels":{"firebase":"enabled"},"createTime":"2024-12-03T00:20:32.400398Z"}
i  functions: preparing codebase default for deployment
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...  
i  functions: ensuring required API cloudbuild.googleapis.com is enabled... 
i  artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled...
[2025-11-21T17:57:52.047Z] Checked if tokens are valid: true, expires at: 1763750405506
[2025-11-21T17:57:52.048Z] Checked if tokens are valid: true, expires at: 1763750405506
[2025-11-21T17:57:52.049Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/real49estate/adminSdkConfig [none]
[2025-11-21T17:57:53.146Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/real49estate/adminSdkConfig 200
[2025-11-21T17:57:53.148Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/real49estate/adminSdkConfig {"projectId":"real49estate","storageBucket":"real49estate.firebasestorage.app"}
[2025-11-21T17:57:53.151Z] Checked if tokens are valid: true, expires at: 1763750405506
[2025-11-21T17:57:53.155Z] Checked if tokens are valid: true, expires at: 1763750405506
[2025-11-21T17:57:53.159Z] >>> [apiv2][query] GET https://runtimeconfig.googleapis.com/v1beta1/projects/real49estate/configs [none]
[2025-11-21T17:57:53.602Z] <<< [apiv2][status] GET https://runtimeconfig.googleapis.com/v1beta1/projects/real49estate/configs 200
[2025-11-21T17:57:53.603Z] <<< [apiv2][body] GET https://runtimeconfig.googleapis.com/v1beta1/projects/real49estate/configs {}
[2025-11-21T17:57:53.607Z] Validating nodejs source
[2025-11-21T17:58:03.727Z] checkFunctionsSDKVersion was unable to fetch information from NPM Error: spawnSync C:\Windows\system32\cmd.exe ETIMEDOUT
    at Object.spawnSync (node:internal/child_process:1123:20)
    at Object.spawnSync (node:child_process:877:24)
    at Function.spawnSync [as sync] (C:\Users\Danny Giftson\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-spawn\index.js:26:23)
    at Object.getLatestSDKVersion (C:\Users\Danny Giftson\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\functions\runtimes\node\versioning.js:54:25) 
    at Object.checkFunctionsSDKVersion (C:\Users\Danny Giftson\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\functions\runtimes\node\versioning.js:74:32)
    at Delegate.validate (C:\Users\Danny Giftson\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\functions\runtimes\node\index.js:89:20)
    at loadCodebases (C:\Users\Danny Giftson\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\functions\prepare.js:312:31)
    at async prepare (C:\Users\Danny Giftson\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\functions\prepare.js:62:24)
    at async chain (C:\Users\Danny Giftson\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\index.js:43:9)
    at async deploy (C:\Users\Danny Giftson\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\index.js:123:9)
[2025-11-21T17:58:03.738Z] > [functions] package.json contents: {
  "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"
  },
  "main": "index.js",
  "dependencies": {
    "axios": "^1.13.2",
    "firebase-admin": "^12.6.0",
    "firebase-functions": "^7.0.0"
  },
  "devDependencies": {
    "firebase-functions-test": "^3.1.0"
  },
  "private": true
}
[2025-11-21T17:58:03.746Z] Building nodejs source
i  functions: Loading and analyzing source code for codebase default to determine what to deploy
[2025-11-21T17:58:03.768Z] Could not find functions.yaml. Must use http discovery[2025-11-21T17:58:03.960Z] Found firebase-functions binary at 'E:\WEB APPS\realestatewebsite\functions\node_modules\.bin\firebase-functions'
[2025-11-21T17:58:14.216Z] Failed to call quitquitquit. This often means the server failed to start request to http://localhost:8512/__/quitquitquit failed, reason:  {"message":"request to http://localhost:8512/__/quitquitquit failed, reason: 
","type":"system","errno":"ECONNREFUSED","code":"ECONNREFUSED"}
Serving at port 8512


Error: User code failed to load. Cannot determine backend specification. Timeout 
after 10000. See https://firebase.google.com/docs/functions/tips#avoid_deployment_timeouts_during_initialization'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions