firebaseでデプロイ時にfuncionsへ関数のデプロイに失敗
エラー文
Function failed on loading user code. Error message: Code in file lib/index.js can't be loaded.
Is there a syntax error in your code?
Detailed stack trace: /srv/node_modules/@google-cloud/firestore/build/src/collection-group.js:54
async *getPartitions(desiredPartitionCount) {
^
SyntaxError: Unexpected token *
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/srv/node_modules/@google-cloud/firestore/build/src/index.js:39:28)
⚠ functions: Warning: Node.js 8 functions are deprecated and will stop running on 2021-03-15. Please upgrade to Node.js 10 or greater by adding an entry like this to your package.json:
{
"engines": {
"node": "12"
}
}
The Firebase CLI will stop deploying Node.js 8 functions in new versions beginning 2020-12-15, and deploys from all CLI versions will halt on 2021-02-15. For additional information, see: https://firebase.google.com/support/faq#functions-runtime
Functions deploy had errors with the following functions:
addDataset
To try redeploying those functions, run:
firebase deploy --only "functions:addDataset"
To continue deploying other features (such as database), run:
firebase deploy --except functions
Error: Functions did not deploy properly.
async *getPartitions(desiredPartitionCount)
非同期通信の関数データ付近でエラーが起きているとわかった。
エラー対処方法
functionsのpackage.jsonの中身を
"dependencies": {
"firebase-admin": "^9.2.0",
"firebase-functions": "^3.11.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^3.9.1",
"@typescript-eslint/parser": "^3.8.0",
"eslint": "^7.6.0",
"eslint-plugin-import": "^2.22.0",
"typescript": "^3.8.0",
"firebase-functions-test": "^0.2.0"
},
から
"dependencies": {
"firebase-admin": "^8.6.0",
"firebase-functions": "^3.3.0"
},
"devDependencies": {
"tslint": "^5.12.0",
"typescript": "^3.2.2",
"firebase-functions-test": "^0.1.6"
へ
削除及び修正し変更。
eslintと相性があわなかったのかもっと予想・・・。
Typescriptに詳しくないので、詳しいことがわかりません。
ヒントになった参考記事
以上となります。
ここは違う、ここはこうしたほうがいいかも?
等々ございましたら、ご指摘いただけますと幸いです。
最後までみていただきありがとうございます。