【Firebase】Cloud Functionsが従量課金プランでしか使えなくなるらしい

朝起きたらFirebaseからこんなメールが

> We are writing to let you know about two upcoming changes to Cloud Functions for Firebase:

> All Firebase developers who use the Cloud Functions Node.js 10 runtime will need to use the “Blaze” pay-as-you-go billing plan.

> The Node.js 10 runtime on Cloud Function has now reached General Availability and the Node.js 8 runtime on Cloud Functions will be deprecated. To avoid potential disruptions or security risks, you should update your functions to Node.js 10.
What Happened?
Starting June 22, 2020, Cloud Functions for Firebase is rolling out a change in our Node.js 10 runtime that will allow you to see the output of the functions build process using Cloud Build and Container Registry. Although Cloud Build and Container Registry have a generous free quota, both products require you to be on the "Blaze" pay-as-you-go plan.

> This change will give you better transparency and control over your Cloud Functions deployments. For more details on the benefits of Cloud Build and Container Registry, please see our online FAQ.

> On Dec 31, 2019, Node.js 8 was marked end-of-life by the Node.js Foundation. The Node.js Foundation stopped issuing security releases for Node.js 8. To ensure that your functions are on a supported version of Node.js, you must update them to the Node.js 10 runtime.

> These changes for Cloud Functions for Firebase will follow this timeline:

> By June 22, 2020, all developers using the Node.js 10 runtime will need to update to the “Blaze” pay-as-you-go billing plan and enable the Cloud Build API in order to continue deploying functions.

> By February 15, 2021, all developers using the Node.js 8 runtime should update to the Node.js 10 runtime and update to the “Blaze” pay-as-you-go billing plan. Developers will no longer be able to create new functions or update existing functions that use Node.js 8.

> By March 15, 2021, Node.js 8 runtime will be shut down for Cloud Functions for Firebase. Functions using Node.js 8 will be disabled after this date.
What do I need to do?
By June 22, 2020, all developers using the Node.js 10 runtime will need to update to the “Blaze” pay-as-you-go billing plan.

> By February 15, 2021, all developers using the Node.js 8 runtime should update to the Node.js 10 runtime and update to the “Blaze” pay-as-you-go billing plan, referred to in the point above.
After you update to the “Blaze” pay-as-you-go billing plan,

> You must enable the Cloud Build API. Either upgrade your Firebase CLI to v8.1.0 or higher, or follow the manual instructions to enable the Cloud Build API below:

> Access the Cloud Build API link in the Cloud Console.
Select your project from the drop-down menu.
Click Continue to enable the Cloud Build API for the project. A box will appear in the lower-left corner to confirm the API is enabled.
Once you enable the Cloud Build API, your project may incur charges if its Cloud Build or Container Registry usage exceeds the free tier limits for these products, in addition to Cloud Functions usage charges. For more information, visit the Cloud Build and Container Registry pricing pages.

>The "Blaze" pay-as-you-go plan includes free tier limits just like the "Spark" free plan. For more info, see the online FAQ. To avoid unexpected bills, it's always good practice to set budget alerts.

>You can find a list of your projects that are using Cloud Functions for Firebase and may be affected by this change below:

>\**********
>If you have any questions or need any assistance, please read our online FAQ. As always, feel free to reach out to us for more assistance.
Thanks,
Raj on behalf of the Firebase team

# つまりどういうこと？
要約するとこんな感じ

1. Cloud FunctionsがNode.js 10になってNode.js 8が非推奨になるよ
2. いまNode.js 8使ってる人はアップデートしてね
3. Node.js 10はBlaza(従量課金）プランでしか使えないからSpark(無料)プラン使ってる人はアップデートしてね
ってことらしい

# いつまでにやらなきゃいけないの？

**2020年6月22日**までに、Node.js 10ランタイムを使用するすべての開発者は、「Blaze」従量課金システムに更新する必要があります。
**2021年2月15日**までに、Node.js 8ランタイムを使用するすべての開発者は、Node.js 10ランタイムに更新し、「Blaze」従量課金制のプランに更新する必要があります。
**2021年3月15日**までに、Cloud Functions for FirebaseのNode.js 8ランタイムがシャットダウンされます。 Node.js 8を使用する機能は、この日付以降無効になります。

# ほかに気になる点は？

1. 影響があるのはCloud Functionsだけで他のFirebaseのサービスを使う分には無料プランのままでも問題ない
2. 従量課金プランに変更しても、無料プランよりも無料枠が増えるらしい

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Deploying Cloud Functions using Node 10 will use those automatically. That&#39;s why Firebase now requires you to have a billing account for deploying Cloud Functions.<br><br>All of these products have a free tier though, higher free limits than the limits of the free plan.</p>&mdash; Frank van Puffelen (@puf) <a href="https://twitter.com/puf/status/1263609464973717504?ref_src=twsrc%5Etfw">May 21, 2020</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

# Node.js 10にアップデートするには

> Node.js のバージョンを設定するには:

> 初期化時に functions/ ディレクトリに作成された package.json ファイルの engines フィールドにバージョンを設定します。たとえば、バージョン 10 のみを使用するには、package.json の次の行を編集します。

>  `"engines": {"node": "10"}`

https://firebase.google.com/docs/functions/manage-functions#set_nodejs_version