0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Firebase Cloud Functions 「HTTP Error: 400, The request has errors」でよくあるミス

Posted at

#Cloud Functionsのエラー
エラーメッセージに含まれてる情報があまりにも少ない。。。:frowning2:

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) => {
    // 略
  });

documentを参照しなければいけないところでcollectionのパスを指定していたので、エラーを突きつけられたようだ。

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?