3

In my webapp I make http call to firebase function that reads RealtimeDatabase. Once I enforce AppCheck, this cloud function in unable to access the RealtimeDatabase. Since I use firebase hosting and templating through functions, My static pages with appscript are showing up, But not this http response page.

code in index.js:

const functions = require("firebase-functions");
const admin = require("firebase-admin");
const express = require("express");
const engines = require("consolidate");
require("@firebase/app")
require("@firebase/app-check")

var serviceAccount = require("./firebase-adminsdk-yjm37-b4444555g6.json");
const { request } = require("express");

admin.initializeApp({
    credential: admin.credential.cert(serviceAccount),
    databaseURL: "https://myappname-default-rtdb.asia-southeast1.firebasedatabase.app"
});

admin.appCheck().activate('asdfgRobdfgdrhRXrNHUlBZtz9ctzUMEAVx');

(truncated)

while deploying this function, I get

Error: Error occurred while parsing your function triggers.

TypeError: admin.appCheck(...).activate is not a function

packages listed on the top of the code are updated to the latest version.

(I trying to learn firebase functions and Node.Js through this webapp)

Yuvaraj K
  • 31
  • 4
  • 3
    This is a known issue in App Check/Realtime Database for the moment. See https://stackoverflow.com/questions/68129683/firebase-app-check-fails-when-accessing-database-from-callable-cloud-function/68136555#68136555 – Frank van Puffelen Jul 07 '21 at 09:52
  • I thought I was missing something. Thanks for the quick response. – Yuvaraj K Jul 07 '21 at 12:34

0 Answers0