Skip to content

Cloud Function receives 404 error when calling FCM API, despite API being enabled. #2970

@imamsy-cloud

Description

@imamsy-cloud

[REQUIRED] Step 2: Describe your environment
Operating System version: Google Cloud Shell (Linux)

Firebase SDK version: firebase-admin@12.0.0

Firebase Product: Messaging (FCM)

Node.js version: 18

NPM version: 11.5.2

[REQUIRED] Step 3: Describe the problem
Title: FCM Admin SDK returns 404 Not Found on send, despite API being enabled

Steps to reproduce:
I am trying to send a push notification using admin.messaging().sendEachForMulticast() from a Cloud Function running in asia-southeast2.

What happened?

The function call consistently fails with a FirebaseError. The log shows a raw HTML server response with a 404 Not Found error. This is happening even though we have confirmed all configurations seem to be correct.

This is what we have already tried and verified:

The "Firebase Cloud Messaging API" (the modern V1 API) is ENABLED in our Google Cloud project (app-signalmax). We have confirmed this via a screenshot.

The project is on the Blaze (Pay as you go) plan and has an active billing account.

The firebase-admin SDK version is up-to-date (^12.0.0).

The Cloud Function is deployed successfully on the Node.js 18 runtime.

The function code correctly reads valid FCM registration tokens from Firestore before attempting to send the notification.

We have tried manually deleting the function from the Google Cloud Console and then redeploying it from scratch. The 404 error still persists.

The issue seems to be a platform-level problem where the enabled FCM API endpoint is unreachable from a Cloud Function within the same project. The disabled "Cloud Messaging API (Legacy)" is not the issue, as we are using the modern SDK.

Update: I have also tried adding the 'Service Account Token Creator' IAM role to the function's service account (app-signalmax@appspot.gserviceaccount.com), but the 404 error still persists. Sending notifications from the Firebase Console works correctly.

Log/console output:
(

Image

Relevant Code.js

)

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