Using the Firestore application in a React application, I test with Google's cloud functions to capture a document field, and then create a new field in Firestore using this field. The other day I worked, and now it is not.
This is the error I get in the Google Cloud Function Log:
Error: Cannot decode type from Firestore value: {"stringValue": "sox"} in DocumentSnapshot._decodeValue
Below is the code I used. It is very similar to the code here: https://firebase.google.com/docs/firestore/extend-with-functions#writing_data
exports.createShowDoubleName = functions.firestore .document('shows/{showId}') .onUpdate((event) => { const data = event.data.data(); const previousData = event.data.previous.data(); if (data.name == previousData.name) return; var name = data.name; var newname = name+"_"+name return event.data.ref.set({ newname: newname }, {merge: true}); });
firebase-functions SDK 0.7.5 . firebase-admin 5.5.0. :
npm install firebase-functions@0.7.5
(0.7.4) firebase-functions.
firebase-functions
, firebase-functions . :
if (data.name == previousData.name) return;
:
if (data.name == previousData.name) return null;
firebase-functions, functions :
functions
npm install firebase-functions@latest --save
I had the same problem and the same error. After updating the firebase and firebase-admin functions (npm install firebase-functions @latest -save) and (npm install firebase-admin @latest -save), he solved the problem. Turning to the logs, the problem seems to be in the old version of firebase-admin. Now I am running the administrative version 5.5.1 and the functions of version 0.7.4.
Definitely just need to update something.
Open a terminal , go to the function folder and run this update:
npm install firebase-functions@latest firebase-admin@latest --save
Source: https://habr.com/ru/post/1690999/More articles:Direct and lower restriction on FloatingActionButton makes it invisible - androidWhat is the best way to use webpacker in a Rails engine? - ruby-on-railsDelete / delete array elements that form a PHP pair - arraysReact Native (iOS) AppRegistry module is not a registered called module (runApplication call) - iosAffirm that an event has been observed - javascriptJPMS/Jigsaw Отсутствует основной класс в модуле - javaУстановка SKPM (Sketch Plugin Manager) через npm - node.jsAsync / Await vs Parellel.For, which is better in this case? - multithreadingIf meta classes in models inherit from an object - pythonWPF - Reducing the flooding effect for a button - c #All Articles