I use Flutter, Timer and Firebase/Firestore.batch to do something like this sample code to save data periodically on Mac. https://github.com/tomoyuki28jp/flutterfire_scheduled_batch_write_sample2
When I run my app for few days, I get this error randomly:
flutter: [cloud_firestore/permission-denied] The caller does not have permission to execute the specified operation.
flutter:
#0 MethodChannelWriteBatch.commit
package:cloud_firestore_platform_interface/…/method_channel/method_channel_write_batch.dart:51
<asynchronous suspension>
- After hot reloading, it start working again.
- Background task keep throwing this error until restarting or reloading my app
- While a background task is throwing this error, I can still successfully save firestore data by using my app UI manually.
How can I investigate the cause?