skip to Main Content

The following typescript function deploys successfully according to the Firebase CLI but not according to the dashboard.

import * as functions from 'firebase-functions';

export const helloWorld = functions.https.onRequest((request, response) => {
  response.send("hello world");
});

Here is my console log:

filippo@MacBook-Air-di-Filippo Cloud Functions % firebase deploy --only functions

=== Deploying to 'my-project-00000'...

i  deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint

> lint
> eslint --ext .js,.ts .

Running command: npm --prefix "$RESOURCE_DIR" run build

> build
> tsc

✔  functions: Finished running predeploy script.
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...
✔  artifactregistry: required API artifactregistry.googleapis.com is enabled
✔  functions: required API cloudbuild.googleapis.com is enabled
✔  functions: required API cloudfunctions.googleapis.com is enabled
i  functions: Loading and analyzing source code for codebase default to determine what to deploy
Serving at port 8313

i  functions: cleaning up build files...

✔  Deploy complete!

Firebase CF dashboard Firebase dashboard

I have mostly followed these tutorials: https://youtu.be/2u6Zb36OQjM?si=qxZd8G2hyIFYNRjq, https://firebase.google.com/docs/functions/get-started?gen=2nd.

Admittedly, my typescript code could be the problem.

Environment

Visual Studio Code 1.88.1

Node 20.12.0

ESLint 9.0.0

Firebase CLI 13.7.3

Safari 17.4.1 (macOS 14.4.1) but also Chrome 122.0.6261.94

MacBook Air M1 8GB

Edit

Note: I have contacted Firebase support but they might have stopped replying.

There’s no problem with asking this question because it’s always contained concerns about the code itself, and if the problem will ever be solved it could save time to both people having it and to the Firebase support.

I tried running npm install from inside the functions directory before I deployed the functions, I also tried logging in and out of the Firebase CLI.

In any case, if I run firebase --debug --only functions deploy as per Firebase support’s suggestion, the following bits catch my attention:

  1. [functions] service account IAM check errored, deploy may fail: HTTP Error: 404, Unknown service account
  2. 0 Functions Deployed

But many others may as well. Here is the full console log in case you’re curious:

filippo@MacBook-Air-di-Filippo Cloud Functions % firebase --debug --only functions deploy
[2024-04-23T08:29:34.687Z] > 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"]
[2024-04-23T08:29:34.688Z] > authorizing via signed-in user ([email protected])
[2024-04-23T08:29:34.688Z] [iam] checking project my-project-00000 for permissions ["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]
[2024-04-23T08:29:34.688Z] > refreshing access token with scopes: []
[2024-04-23T08:29:34.689Z] >>> [apiv2][query] POST https://www.googleapis.com/oauth2/v3/token [none]
[2024-04-23T08:29:34.689Z] >>> [apiv2][body] POST https://www.googleapis.com/oauth2/v3/token [omitted]
[2024-04-23T08:29:35.398Z] <<< [apiv2][status] POST https://www.googleapis.com/oauth2/v3/token 200
[2024-04-23T08:29:35.398Z] <<< [apiv2][body] POST https://www.googleapis.com/oauth2/v3/token [omitted]
[2024-04-23T08:29:35.406Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects/my-project-00000:testIamPermissions [none]
[2024-04-23T08:29:35.406Z] >>> [apiv2][(partial)header] POST https://cloudresourcemanager.googleapis.com/v1/projects/my-project-00000:testIamPermissions x-goog-quota-user=projects/my-project-00000
[2024-04-23T08:29:35.407Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/my-project-00000:testIamPermissions {"permissions":["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]}
[2024-04-23T08:29:35.557Z] <<< [apiv2][status] GET https://firebase-public.firebaseio.com/cli.json 200
[2024-04-23T08:29:35.558Z] <<< [apiv2][body] GET https://firebase-public.firebaseio.com/cli.json {"cloudBuildErrorAfter":1594252800000,"cloudBuildWarnAfter":1590019200000,"defaultNode10After":1594252800000,"minVersion":"3.0.5","node8DeploysDisabledAfter":1613390400000,"node8RuntimeDisabledAfter":1615809600000,"node8WarnAfter":1600128000000}
[2024-04-23T08:29:36.541Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects/my-project-00000:testIamPermissions 200
[2024-04-23T08:29:36.542Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/my-project-00000:testIamPermissions {"permissions":["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]}
[2024-04-23T08:29:36.543Z] >>> [apiv2][query] POST https://iam.googleapis.com/v1/projects/my-project-00000/serviceAccounts/[email protected]:testIamPermissions [none]
[2024-04-23T08:29:36.543Z] >>> [apiv2][body] POST https://iam.googleapis.com/v1/projects/my-project-00000/serviceAccounts/[email protected]:testIamPermissions {"permissions":["iam.serviceAccounts.actAs"]}
[2024-04-23T08:29:37.095Z] <<< [apiv2][status] POST https://iam.googleapis.com/v1/projects/my-project-00000/serviceAccounts/[email protected]:testIamPermissions 404
[2024-04-23T08:29:37.095Z] <<< [apiv2][body] POST https://iam.googleapis.com/v1/projects/my-project-00000/serviceAccounts/[email protected]:testIamPermissions {"error":{"code":404,"message":"Unknown service account","status":"NOT_FOUND"}}
[2024-04-23T08:29:37.096Z] [functions] service account IAM check errored, deploy may fail: HTTP Error: 404, Unknown service account {"name":"FirebaseError","children":[],"context":{"body":{"error":{"code":404,"message":"Unknown service account","status":"NOT_FOUND"}},"response":{"statusCode":404}},"exit":1,"message":"HTTP Error: 404, Unknown service account","status":404}

=== Deploying to 'my-project-00000'...

i  deploying functions 
Running command: npm --prefix "$RESOURCE_DIR" run lint

> lint
> eslint --ext .js,.ts .

Running command: npm --prefix "$RESOURCE_DIR" run build

> build
> tsc

✔  functions: Finished running predeploy script. 
[2024-04-23T08:29:42.019Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/my-project-00000 [none]
[2024-04-23T08:29:42.669Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/my-project-00000 200
[2024-04-23T08:29:42.669Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/my-project-00000 {"projectId":"my-project-00000","projectNumber":"849399059679","displayName":"Hello Pizza","name":"projects/my-project-00000","resources":{"hostingSite":"my-project-00000"},"state":"ACTIVE","etag":"1_8d259d27-e405-4f7a-9cfa-87297ca89976"}
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... 
[2024-04-23T08:29:42.673Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/my-project-00000/services/cloudfunctions.googleapis.com [none]
[2024-04-23T08:29:42.673Z] >>> [apiv2][(partial)header] GET https://serviceusage.googleapis.com/v1/projects/my-project-00000/services/cloudfunctions.googleapis.com x-goog-quota-user=projects/my-project-00000
[2024-04-23T08:29:42.675Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/my-project-00000/services/runtimeconfig.googleapis.com [none]
[2024-04-23T08:29:42.676Z] >>> [apiv2][(partial)header] GET https://serviceusage.googleapis.com/v1/projects/my-project-00000/services/runtimeconfig.googleapis.com x-goog-quota-user=projects/my-project-00000
[2024-04-23T08:29:42.677Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/my-project-00000/services/cloudbuild.googleapis.com [none]
[2024-04-23T08:29:42.677Z] >>> [apiv2][(partial)header] GET https://serviceusage.googleapis.com/v1/projects/my-project-00000/services/cloudbuild.googleapis.com x-goog-quota-user=projects/my-project-00000
[2024-04-23T08:29:42.678Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/my-project-00000/services/artifactregistry.googleapis.com [none]
[2024-04-23T08:29:42.678Z] >>> [apiv2][(partial)header] GET https://serviceusage.googleapis.com/v1/projects/my-project-00000/services/artifactregistry.googleapis.com x-goog-quota-user=projects/my-project-00000
[2024-04-23T08:29:44.092Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/my-project-00000/services/runtimeconfig.googleapis.com 200
[2024-04-23T08:29:44.093Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/my-project-00000/services/runtimeconfig.googleapis.com [omitted]
[2024-04-23T08:29:44.094Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/my-project-00000/services/artifactregistry.googleapis.com 200
[2024-04-23T08:29:44.094Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/my-project-00000/services/artifactregistry.googleapis.com [omitted]
✔  artifactregistry: required API artifactregistry.googleapis.com is enabled 
[2024-04-23T08:29:44.111Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/my-project-00000/services/cloudfunctions.googleapis.com 200
[2024-04-23T08:29:44.111Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/my-project-00000/services/cloudfunctions.googleapis.com [omitted]
✔  functions: required API cloudfunctions.googleapis.com is enabled 
[2024-04-23T08:29:44.187Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/my-project-00000/services/cloudbuild.googleapis.com 200
[2024-04-23T08:29:44.187Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/my-project-00000/services/cloudbuild.googleapis.com [omitted]
✔  functions: required API cloudbuild.googleapis.com is enabled 
[2024-04-23T08:29:44.188Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/my-project-00000/adminSdkConfig [none]
[2024-04-23T08:29:44.478Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/my-project-00000/adminSdkConfig 200
[2024-04-23T08:29:44.478Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/my-project-00000/adminSdkConfig {"projectId":"my-project-00000","storageBucket":"my-project-00000.appspot.com"}
[2024-04-23T08:29:44.478Z] >>> [apiv2][query] GET https://runtimeconfig.googleapis.com/v1beta1/projects/my-project-00000/configs [none]
[2024-04-23T08:29:45.120Z] <<< [apiv2][status] GET https://runtimeconfig.googleapis.com/v1beta1/projects/my-project-00000/configs 200
[2024-04-23T08:29:45.120Z] <<< [apiv2][body] GET https://runtimeconfig.googleapis.com/v1beta1/projects/my-project-00000/configs {}
[2024-04-23T08:29:45.123Z] Validating nodejs source
[2024-04-23T08:29:45.853Z] > [functions] package.json contents: {
  "name": "functions",
  "scripts": {
    "lint": "eslint --ext .js,.ts .",
    "build": "tsc",
    "build:watch": "tsc --watch",
    "serve": "npm run build && firebase emulators:start --only functions",
    "shell": "npm run build && firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "engines": {
    "node": "18"
  },
  "main": "lib/index.js",
  "dependencies": {
    "firebase-admin": "^11.8.0",
    "firebase-functions": "^4.3.1"
  },
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^5.12.0",
    "@typescript-eslint/parser": "^5.12.0",
    "eslint": "^8.9.0",
    "eslint-config-google": "^0.14.0",
    "eslint-plugin-import": "^2.25.4",
    "firebase-functions-test": "^3.1.0",
    "typescript": "^4.9.0"
  },
  "private": true
}
[2024-04-23T08:29:45.853Z] Building nodejs source
i  functions: Loading and analyzing source code for codebase default to determine what to deploy 
[2024-04-23T08:29:45.854Z] Could not find functions.yaml. Must use http discovery
[2024-04-23T08:29:45.861Z] Found firebase-functions binary at '/Users/filippo/Library/Mobile Documents/com~apple~CloudDocs/Cloud Functions/functions/node_modules/.bin/firebase-functions'
Serving at port 8882

[2024-04-23T08:29:45.999Z] Got response from /__/functions.yaml {"endpoints":{},"specVersion":"v1alpha1","requiredAPIs":[]}
[2024-04-23T08:29:51.017Z] >>> [apiv2][query] GET https://cloudfunctions.googleapis.com/v1/projects/my-project-00000/locations/-/functions [none]
[2024-04-23T08:29:51.932Z] <<< [apiv2][status] GET https://cloudfunctions.googleapis.com/v1/projects/my-project-00000/locations/-/functions 200
[2024-04-23T08:29:51.932Z] <<< [apiv2][body] GET https://cloudfunctions.googleapis.com/v1/projects/my-project-00000/locations/-/functions {}
[2024-04-23T08:29:51.935Z] >>> [apiv2][query] GET https://cloudfunctions.googleapis.com/v2/projects/my-project-00000/locations/-/functions filter=environment%3D%22GEN_2%22
[2024-04-23T08:29:53.026Z] <<< [apiv2][status] GET https://cloudfunctions.googleapis.com/v2/projects/my-project-00000/locations/-/functions 200
[2024-04-23T08:29:53.027Z] <<< [apiv2][body] GET https://cloudfunctions.googleapis.com/v2/projects/my-project-00000/locations/-/functions {}
[2024-04-23T08:29:53.037Z] Total Function Deployment time: 0
[2024-04-23T08:29:53.037Z] 0 Functions Deployed
[2024-04-23T08:29:53.037Z] 0 Functions Errored
[2024-04-23T08:29:53.037Z] 0 Function Deployments Aborted
[2024-04-23T08:29:53.037Z] Average Function Deployment time: NaN
i  functions: cleaning up build files... 

✔  Deploy complete! 

Project Console: https://console.firebase.google.com/project/my-project-00000/overview

How can I pinpoint the issue?

2

Answers


  1. Chosen as BEST ANSWER

    Upon updating the Firebase CLI to version 13.7.5, I tried to re-deploy my function but ESLint was giving me issues for no clear reason, so I ran cd functions && npx eslint . --fix, which fixed it, and then the re-deployment of my helloWorld() function succeeded.


  2. Sharing this as a community wiki for the benefit of others

    As mentioned by @Doug Stevenson

    There is an error message on your console screenshot in the upper right. That seems like it could be masking the underlying problem. If you’re having problems with the console that you don’t understand, contact Firebase support directly about it, since there is not much the volunteers here can do about it.

    Additionally you can do the following troubleshooting options:

    • Check out Firebase logs. You can view your logs through the console, Cloud Logging UI, or by the firebase CLI too

    • Check out this Stackoverflow post. You can run npm install in the function directory before deploying the function.

    • You can contact Firebase Support to further look into your case.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search