admin管理员组

文章数量:1356904

Error Message

[info] Functions deploy had errors with the following functions: addmessage(us-central1) [debug] [2025-03-27T22:03:14.260Z] Not printing URL for HTTPS function. Typically this means it didn't match a filter or we failed deployment [debug] [2025-03-27T22:03:14.260Z] Checked if tokens are valid: true, expires at: 1743114349603 [debug] [2025-03-27T22:03:14.260Z] Checked if tokens are valid: true, expires at: 1743114349603 [debug] [2025-03-27T22:03:14.261Z] >>> [apiv2][query] GET [none] [debug] [2025-03-27T22:03:15.047Z] <<< [apiv2][status] GET 200 [debug] [2025-03-27T22:03:15.047Z] <<< [apiv2][body] GET {"name":"projects/startup36-227ae/locations/us-central1/repositories/gcf-artifacts","format":"DOCKER","createTime":"2025-03-27T20:39:45.042913Z","updateTime":"2025-03-27T20:40:24.873562Z","mode":"STANDARD_REPOSITORY","cleanupPolicies":{"firebase-functions-cleanup":{"id":"firebase-functions-cleanup","action":"DELETE","condition":{"tagState":"ANY","olderThan":"86400s"}}},"cleanupPolicyDryRun":true,"vulnerabilityScanningConfig":{"enablementConfig":"INHERITED","lastEnableTime":"2025-03-27T20:39:34.500068118Z","enablementState":"SCANNING_DISABLED","enablementStateReason":"API containerscanning.googleapis is not enabled."},"satisfiesPzi":true,"registryUri":"us-central1-docker.pkg.dev/startup36-227ae/gcf-artifacts","dockerConfig":{}} [debug] [2025-03-27T22:03:15.049Z] Functions deploy failed. [debug] [2025-03-27T22:03:15.049Z] {} [debug] [2025-03-27T22:03:15.061Z] TypeError: Cannot read properties of null (reading 'length') at Object.formatServiceAccount (C:\Users\zhuan\AppData\Roaming\npm\node_modules\firebase-tools\lib\gcp\proto.js:95:24) at C:\Users\zhuan\AppData\Roaming\npm\node_modules\firebase-tools\lib\gcp\cloudfunctionsv2.js:196:122 at Object.convertIfPresent (C:\Users\zhuan\AppData\Roaming\npm\node_modules\firebase-tools\lib\gcp\proto.js:45:25) at Object.functionFromEndpoint (C:\Users\zhuan\AppData\Roaming\npm\node_modules\firebase-tools\lib\gcp\cloudfunctionsv2.js:196:11) at Fabricator.createV2Function (C:\Users\zhuan\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\functions\release\fabricator.js:233:35) at Fabricator.createEndpoint (C:\Users\zhuan\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\functions\release\fabricator.js:137:24) at C:\Users\zhuan\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\functions\release\fabricator.js:103:64 at handle (C:\Users\zhuan\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\functions\release\fabricator.js:89:23) at Fabricator.applyChangeset (C:\Users\zhuan\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\functions\release\fabricator.js:103:26) at C:\Users\zhuan\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\functions\release\fabricator.js:69:40 [error]

My index.js looks like this:

const {onRequest} = require("firebase-functions/v2/https");
const logger = require("firebase-functions/logger");
// The Firebase Admin SDK to access Firestore.
const {initializeApp} = require("firebase-admin/app");
const {getFirestore} = require("firebase-admin/firestore");

initializeApp();

exports.addmessage = onRequest(async (req, res) => {
  // Grab the text parameter.
  const original = req.query.text;
  // Push the new message into Firestore using the Firebase Admin SDK.
  const writeResult = await getFirestore()
      .collection("messages")
      .add({original: original});
    // Send back a message that we've successfully written the message
  res.json({result: `Message with ID: ${writeResult.id} added.`});
});

I keep getting this Service Account Format error and I've tried all the following:

  1. downgrading firebase CLI
  2. downgrading to Gen1 from Gen2
  3. adding service account metadata

But nothing seems to work, please help!

If I need to add service account information, where should I add it? I have the default service account on my google cloud platform with the following configuration: enter image description here

本文标签: nodejsError with Firebase deployservice account format issueStack Overflow