Loading Firebase Admin on Server Side

#1

I am working on a React Native / Meteor combo, Where Meteor is my server. I need to set up a Firebase admin instance to send an API request for triggering push notifications for my React Native app.

I have installed the Firebase NPM SDK, when I go to import and/or require the firebase.admin object instance is empty or incomplete. Works fine if I load it into a normal node app setup.

I am assuming there is a latency with the import/require. I looked at some wrapper packages but they are outdated and unmaintained.

import * as admin from 'firebase-admin'
console.log(admin)

Should print

    FirebaseNamespace {
  __esModule: true,
  credential: 
   { cert: [Function: cert],
     refreshToken: [Function: refreshToken],
     applicationDefault: [Function: applicationDefault] },
  SDK_VERSION: '6.2.0',
  Promise: [Function: Promise],
  INTERNAL: 
   FirebaseNamespaceInternals {
     firebase_: [Circular],
     serviceFactories: {},
     apps_: {},
     appHooks_: {} },
  default: [Circular] }

But instead prints

{ default: {}, [Symbol(__esModule)]: true }
#2

Not sure what goes wrong here, but it might have to do woth the wildcard import. I’ve never used that one in Meteor projects. Can you check if importing the functions separatly does work? Eg:

import { credential } from `firebase-admin`;
#3

I have not found an answer to this yet, but as a work around I made a call to firebase functions.