I am using the base typescript install of firebase init functions. My project keeps throwing the following error:
> npm run build:watch | firebase emulators:start --only functions
i emulators: Starting emulators: functions
⚠ functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: auth, firestore, database, hosting, pubsub, storage, eventarc
⚠ Your requested "node" version "16" doesn't match your global version "18". Using node@18 from host.
i ui: Emulator UI logging to ui-debug.log
i functions: Watching "/Users/petertoth/Documents/AntlerSlackBotFE/firebase/functions" for Cloud Functions...
⬢ functions: Failed to load function definition from source: FirebaseError: Failed to load function definition from source: Failed to generate manifest from function source: TypeError: Cannot read properties of undefined (reading 'INTERNAL')
Env:
local:
% firebase -V: 11.9.0
% tsc -V: Version 4.8.3
% node --version: v18.7.0
% npm --version: 8.15.0
project:
"dependencies": {
"firebase-admin": "^10.2.0",
"firebase-functions": "^3.23.0"
},
"devDependencies": {
"typescript": "^4.6.4"
},
Steps to reproduce:
firebase init functions- copy and pasta the following into
index.ts, the actual values offirebaseConfigdo not matter:
const firebaseConfig = {
apiKey: "no",
authDomain: "Iamnot.myjazz.com",
projectId: "heloogroot",
storageBucket: "hello.bello.com",
messagingSenderId: "123456789123",
appId: "1:64646546:web:123456789123",
measurementId: "G-JANDSJANS5"
};
const app = initializeApp(firebaseConfig)
const fn = functions.region('europe-west1')
const db = getFirestore()
export const healthCheckDB = fn.https.onRequest(async (request, response) => {
const result = (await db.doc('doesnmatter').get()).data()
response.send(result)
});
- run
npm run build && firebase emulators:start --only functions