Firebase Cloud Functions 「HTTP Error: 400, The request has errors」でよくあるミス
2847 ワード
Cloud Functionsのエラー
エラーメッセージに含まれてる情報があまりにも少ない。。。
HTTP Error: 400, The request has errors
Functions deploy had errors with the following functions:
myFuction
To try redeploying those functions, run:
firebase deploy --only functions: myFuction
To continue deploying other features (such as database), run:
firebase deploy --except functions
Error: Functions did not deploy properly.
404エラーの原因は何よ?ってことで、結構手こずった。。が、タイプミス並みの凡ミスでした。。
原因
ダメなパターン
index.ts
exports.myFuction = functions.firestore
.document('users/{userId}/events')
.onWrite((change, context) => {
// 略
});
OKなパターン
index.ts
exports.myFuction = functions.firestore
.document('users/{userId}/events/{eventId}')
.onWrite((change, context) => {
// 略
});
index.ts
exports.myFuction = functions.firestore
.document('users/{userId}/events')
.onWrite((change, context) => {
// 略
});
index.ts
exports.myFuction = functions.firestore
.document('users/{userId}/events/{eventId}')
.onWrite((change, context) => {
// 略
});
documentを参照しなければいけないところでcollectionのパスを指定していたので、エラーを突きつけられたようだ。
Author And Source
この問題について(Firebase Cloud Functions 「HTTP Error: 400, The request has errors」でよくあるミス), 我々は、より多くの情報をここで見つけました https://qiita.com/kokogento/items/744c56a55a92e28eb588著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .