TypeError: Cannot read property 'https' of undefined

I have a nuxt app built with firebase and vue. Everytime I run my emulator, it would not proceed because of this error: TypeError: Cannot Find Property 'https' of undefined. I am having problems with my https in my index.ts file. It says that they cannot find this property. I already imported everything from firebase-functions but it still doesnt work.

This was added in the first line: const { functions } = require("firebase-functions");

I also have this line of code: exports.nuxtssr = functions.https.onRequest(app);

I found some solutions in Stack Overflow and tried these solutions, but it still would not work: How to import firebase-functions and firebase-admin in ES6 syntax for transpiling with Babel for Node 10

2 answers

  • answered 2021-03-03 02:39 Yaser

    Your require statement is wrong (you've mixed the import syntax with require):

    const functions = require('firebase-functions');

  • answered 2021-03-03 07:24 Alex Rufus

    I managed to check my files and finally fixed my error. I have a lib folder that stores the transpiled ts to js. And I just fixed it there. IT turned out that the functions object was not read in js.