非法数量 'SPEED' firebase firestore
illegal number 'SPEED' firebase firestore
我正在尝试将数据导入到我的 firestore 中,但我遇到了这个我似乎无法调试的奇怪错误。
firebase 代码类似于:
const db = admin.firestore();
const batch = db.batch();
data.forEach(item => {
const ref = db.collection('data').doc(item.id);
const {id, ...newItem} = item;
batch.set(ref, newItem);
});
return batch.commit();
调用堆栈
Error: illegal number 'SPEED' (/node_modules/google-proto-files/google/protobuf/descriptor.proto, line 52)
at illegal (/node_modules/google-gax/node_modules/protobufjs/src/parse.js:94:16)
at parseNumber (/node_modules/google-gax/node_modules/protobufjs/src/parse.js:174:15)
at readValue (/node_modules/google-gax/node_modules/protobufjs/src/parse.js:125:20)
at parseOptionValue (/node_modules/google-gax/node_modules/protobufjs/src/parse.js:573:37)
at parseOption (/node_modules/google-gax/node_modules/protobufjs/src/parse.js:551:9)
at parse (/node_modules/google-gax/node_modules/protobufjs/src/parse.js:721:17)
at process (/node_modules/google-gax/node_modules/protobufjs/src/root.js:107:30)
正如@chris 在他的评论中所说,如果您将调试器设置为捕获所有异常,则会发生此错误,这是我的错误。
要解决此问题,只需删除调试器选项即可捕获所有异常。
我正在尝试将数据导入到我的 firestore 中,但我遇到了这个我似乎无法调试的奇怪错误。
firebase 代码类似于:
const db = admin.firestore();
const batch = db.batch();
data.forEach(item => {
const ref = db.collection('data').doc(item.id);
const {id, ...newItem} = item;
batch.set(ref, newItem);
});
return batch.commit();
调用堆栈
Error: illegal number 'SPEED' (/node_modules/google-proto-files/google/protobuf/descriptor.proto, line 52)
at illegal (/node_modules/google-gax/node_modules/protobufjs/src/parse.js:94:16)
at parseNumber (/node_modules/google-gax/node_modules/protobufjs/src/parse.js:174:15)
at readValue (/node_modules/google-gax/node_modules/protobufjs/src/parse.js:125:20)
at parseOptionValue (/node_modules/google-gax/node_modules/protobufjs/src/parse.js:573:37)
at parseOption (/node_modules/google-gax/node_modules/protobufjs/src/parse.js:551:9)
at parse (/node_modules/google-gax/node_modules/protobufjs/src/parse.js:721:17)
at process (/node_modules/google-gax/node_modules/protobufjs/src/root.js:107:30)
正如@chris 在他的评论中所说,如果您将调试器设置为捕获所有异常,则会发生此错误,这是我的错误。
要解决此问题,只需删除调试器选项即可捕获所有异常。