I'm currently writing my cloud functions in ES6 and transpiling with Babel to target the Node v10 environment. And I've noticed something weird.
Why is that when I import firebase-functions
like this:
import functions from 'firebase-functions';
I get this error:
! TypeError: Cannot read property 'https' of undefined
at Object.<anonymous> (C:\myProject\functions\index.js:28:55)
And to fix it, I need to import it like this:
import * as functions from 'firebase-functions';
While the following import
works just fine for the firebase-admin
:
import admin from 'firebase-admin';
QUESTION
In short terms, the question is:
Why is that:
import functions from 'firebase-functions'; // DOESN'T WORK
import * as functions from 'firebase-functions'; // WORKS
import admin from 'firebase-admin'; // WORKS