4

I'm attempting to use Object.values() in one of my Firebase Cloud Functions, but it isn't recognized as a function. I assume this means that es7 functions aren't available on Firebase Cloud Functions. My question is two-fold:

First, is this true? Second, I recognize that the function isn't supported by some browsers, but I wonder if that's important for Firebase Cloud Functions. Can anyone explain this to me?

J. Adam Connor
  • 1,492
  • 2
  • 15
  • 33

3 Answers3

7

According to node.green, Firebase only supports the LTS version of Node which is currently at the version 6.10.x and Object.values is still behind experimental flag in Node 6.10.x.

Hope this cleared your doubt!

motss
  • 548
  • 3
  • 5
1

Ran into the same issue. check out this answer that recommends using the Object.keys function and chaining it to the built in map function that comes with the array prototype.

Community
  • 1
  • 1
Tope
  • 810
  • 2
  • 11
  • 15
0

Node 8 is available for cloud functions now. Try upgrading your environment.

You probably just need to:

  • Add "engines": { "node": "8" } to your /functions/package.json. Example.

In case it still doesn't work:

  • Upgrade your firebase-functions to the latest version
  • Upgrade firebase-tools to the latest version
ajorquera
  • 952
  • 16
  • 22