bouzuya.hatenablog.com

ぼうずやのにっき

ABC110 の A, B, C を解いた / Cloud Firestore を試している

ABC110 : AtCoder Beginner Contest 110 の A, B, C を解いた。


Cloud Firestore を試している。

ネイティブモードと Datastore モードで迷ってネイティブモードにした。 Datastore は互換性のために残している……とかの雰囲気があるので。 Datastore でつくったらネイティブモードに移行させようとしてくる。

Rust から使いたいので client library ではなく REST (or gRPC) API を直接使う。ひとまず REST で。

createDocument でいきなりハマる。

HTTP 403 が返ってくる。 CONSUMER_INVALID 。原因は Project ID の typo 。ひどい。

https://stackoverflow.com/questions/66518534/httperror-403-with-consumer-invalid-as-the-reason-when-deploying-a-machine-learn

あとは createDocument の request body の Document の name の指定。

https://cloud.google.com/firestore/docs/reference/rest/v1/projects.databases.documents/createDocument

REST のドキュメントには何も書いていないので指定してしまうけど指定すると createDocument は通らない。実は RPC 側のドキュメントには指定してはいけないと記載されている。

https://cloud.google.com/firestore/docs/reference/rpc/google.firestore.v1#google.firestore.v1.CreateDocumentRequest

Document Required. The document to create. name must not be set.


なんだか体がだるい……。


今日のコミット。