zhifez

If like me, you’ve came across one of the following error while trying access FirebaseAdmin’s services, i.e.:

  1. “The default Firebase app does not exist…”
  2. “_this.ensureApp(…).firestore is not a function”
  3. “TypeError: firebaseApp.getOrInitService is not a function”

The solution is simply doing the following:

Explanation: Using the first element in admin.apps (App[]), instead of the default app (admin.app).

--

--

It works a little like React, sans the “process” prefix (which the compiler will tell you it doesn’t exists).

First, add a “VITE_” prefix to all your variables in your .env file.

Example:

VITE_VARIABLE_NAME=value
VITE_MODE=development

Then, when you want to use it in your Svelte+Vite project, use:

import.meta.env.VITE_VARIABLE_NAME
import.meta.env.VITE_MODE

--

--