My cloud function is logging out this error while it is being called.
Error: 13 INTERNAL: An internal error occurred.
at callErrorFromStatus (/workspace/node_modules/google-gax/node_modules/@grpc/grpc-js/build/src/call.js:31:19)
at Object.onReceiveStatus (/workspace/node_modules/google-gax/node_modules/@grpc/grpc-js/build/src/client.js:192:76)
at Object.onReceiveStatus (/workspace/node_modules/google-gax/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:360:141)
at Object.onReceiveStatus (/workspace/node_modules/google-gax/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:323:181)
at /workspace/node_modules/google-gax/node_modules/@grpc/grpc-js/build/src/resolving-call.js:94:78
at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
This error is coming from this function
const insert = await admin
.firestore()
.collection(myCollection)
.add(insertFSObject)
.catch((error) => {
console.log(`Insert failed document ${insertFSObject.name} at ${insertFSObject.created}`)
console.log(error);
});
I have monitored my cloud functions and the error seems to be not appear again which is very weird because all the transactions and logs before or after the errors are successful calls. How can I fix this error when it is not frequently occurred.