DEV Community

Takaya Kobayashi
Takaya Kobayashi

Posted on

5 2

Firebase Functions で Node.js 8 使えるようになったぞ〜〜〜!!!

tldr

  • firebase-tools をアップグレードする
  • functions/package.json"engines": { "node": "8" } を追加する
  • firebase deploy

経緯

https://cloud.google.com/functions/docs/concepts/nodejs-8-runtime でしれっと(?) Cloud Functions で Node.js 8 が使えることが書いてあって(あと Python)小躍りしながら試しました。

じゃあ Firebase Functions でも使えるんじゃね...?と調べてみても、全く情報が出てきませんでした。ウェブのコンソールからランタイムを変更できる、と書いてる記事もあったのですが自分のプロジェクトにはそういう項目はなく...。

firebase-tools のリポジトリを runtime で検索すると対応しているっぽい雰囲気がありました。しばらくコード追ったりした後に、最初に気付けばよかったんですが、リリースノートにちゃんと書いてありました。

https://github.com/firebase/firebase-tools/releases/tag/v4.0.0

まずはちゃんとリリースノートを読もうな!

余談

しばらく見ない間に TypeScript にもオフィシャルに対応していて firebase init で対話的にプロジェクトを作成する際に TS でスキャッフォルドを作ってくれるのでお手軽に型を付けられるようになっていた。かなりマトモな環境の Node.js 8 で動かすものを TS で書けるとなるとだいぶ選択肢に入ってくるのでは...?というカンジがした。まだ beta っぽいけどガンバッテほしい...!

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay