'I can add a new document to Firebase Firestore but not update one, why?
I'm using Firebase's Firestore database and haven't had any issues until today - I have no problems reading data or adding new documents to the collections. What I can't seem to do now is update an existing document (which was working previously).
What could be causing this?
Code for the update >
func updateSite(site: Site) -> Bool {
let db = Firestore.firestore()
do {
try db.collection("Sites").document(site.id ?? "Unknown ID").setData(from: site)
return true
} catch {
print(error)
return false
}
}
Edit- I'm working in Swift (iOS) via Xcode 13.3. There haven't been any changes to the code to deal with Firestore but I did switch to using Firebase-cloud-storage for images, other than that nothing I can see impacting here.
The error on update is returned as an Auth Error - (See below)
: 2022-03-23 06:06:44.462999+1300 Scout[15793:933890] 8.13.0 - [Firebase/Firestore][I-FST000001] AppCheck failed: 'The operation couldn’t be completed. Too many attempts. Underlying error: The operation couldn’t be completed. The server responded with an error:
- URL: https://firebaseappcheck.googleapis.com/v1beta/projects/(edited) 9:exchangeDeviceCheckToken
- HTTP status code: 400
- Response body: { "error": { "code": 400, "message": "App not registered: 1:587919427052:ios:ad2ac8f3abd4cbd5fc6cc9.", "status": "FAILED_PRECONDITION" }
As far as I can see there aren't any denied requests showing in the Firebase web console and no other Firestore requests (reads / Writes) from the App are preformed without issue.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
