Victor Molina
Victor Molina

Reputation: 2641

Firebase Admin SDK Error Requested Project Not Found

FIREBASE CONFIGURATION

I have those two service accounts in my Firebase Project

1) [email protected]
2) [email protected]

In the IAM configuration, the first account has the role "Editor", and the second has:

1) Administrator Service Agent for the Administrator SDK
2) Service account token creator
3) Storage Manager

The code of my cloud functions is just:

const functions = require("firebase-functions");
const admin = require("firebase-admin");
const sizeOf = require("image-size");
const url = require("url");
const https = require("https");

// Initialize App
admin.initializeApp({
  databaseURL: "https://project-id.firebaseio.com",
  storageBucket: "project-id.appspot.com",
});

// Create Storage
const storage = admin.storage();

// Create Firestore
const firestore = admin.firestore();

// Validate image dimensions
exports.validateImageDimensions = functions
  .region("us-central1")
  // Increased memory, decreased timeout (compared to defaults)
  .runWith({ memory: "2GB", timeoutSeconds: 120 })
  .https.onCall(async (data, context) => {
    // Get the image's owner
    const owner = context.auth.token.uid;

    // Get the image's info
    const { id, description, location, tags, time } = data;

    // Get the photos' bucket
    const bucket = storage.bucket("photos");
    ...

And my service account is just the .json generated on the Firebase Console:

Project Configuration > Service Accounts > Firebase Admin SDK -> Generate Private Key

ERROR

When calling the function I get this error:

{
  "error": {
    "code": 404,
    "message": "The requested project was not found.",
    "errors": [
      {
        "message": "The requested project was not found.",
        "domain": "global",
        "reason": "notFound"
      }
    ]
  }
}

Any ideas?

Upvotes: 0

Views: 781

Answers (1)

Harif Velarde
Harif Velarde

Reputation: 753

It seems that you are using the service account without roles, I suggest you take a look at this documentation.

Also, this is a common issue you can check another threads here and try with some workaround suggested.

Just as a kind reminder, I suggest you check if the URL declared https://project-id.firebaseio.com wast set without mistakes, when I try to enter to URL I'm getting the message: "not found".

If this behavior persists I think you could try to report your use as is recommended here

Upvotes: 1

Related Questions