Abstract#
| FirebaseのFunctionsを使ってみる。 | 
Topics#
Quick Start#
- js
Running command: npm --prefix "$RESOURCE_DIR" run lint
| 進めていくと、firebase deployをやるあたりで、こういうのがでてきて、 | 
Oops! Something went wrong! :( ... No files matching the pattern "." were found. Please check for typing mistakes in the pattern.
| となる。なんとなくWindowsでやると避けられないっぽい[1]ので、firebase.jsonにあるpredeployの部分の該当するところをコメントアウトするとうまく動くようになる。 | 
やりたいこと#
- Firestoreにデータが追加されたら、何かやる。
| I want to do this[2].ハローワールドに相当するのはここかな[3]。 | 
| functionsフォルダの中のindex.jsをいじっていくのが基本。 | 
| realtime databaseとcloud firestoreでアクセス方法が異なるので注意。database.ref()とfirestore.document() | 
| HTTP Error: 400, Change of function trigger type or event provider is not allowedがでたら、そのFunctionを一度削除してもう一度Deployすると動く[4] | 
Reference#
- [#1]001AJD, 2018年7月, Deploy error on Windows: "Running command: npm --prefix "$RESOURCE_DIR" run lint" #822, https://github.com/firebase/firebase-tools/issues/822  
- [#2]Google, 2018年6月、Realtime Database トリガー, https://firebase.google.com/docs/functions/database-events?hl=ja  
- [#3]koki_cheese, 2017年03月12日に更新, Cloud Functions for Firebaseとは?, https://qiita.com/koki_cheese/items/013d4e6ab5aefc792388  
- [#4]吉川 正倫, 2018年1月17日, GoogleのFirebaseが面白いかもしれない 〜Functions〜,https://norm-nois.com/blog/archives/4040