|
| 1 | +# Unknown attribute: "specification" |
| 2 | + |
| 3 | +## **Date and time** |
| 4 | + |
| 5 | +- **Incident Start:** 2024-08-10 15:16 UTC |
| 6 | +- **Incident End:** 2024-08-10 18:29 UTC |
| 7 | +- **Report Prepared By:** Steven Nguyen |
| 8 | + |
| 9 | +## Summary |
| 10 | + |
| 11 | +On August 10th, we received reports about functions failing to build with the following error: |
| 12 | + |
| 13 | +``` |
| 14 | +Invalid document structure: Unknown attribute: "specification" |
| 15 | +``` |
| 16 | + |
| 17 | +After digging into the code and database, we discovered the `specification` column was in the functions tables, but it wasn't in all of the metadata. |
| 18 | + |
| 19 | +After removing the `specification` column from the functions table, function creation and builds worked again. |
| 20 | + |
| 21 | +Any functions created during the incident will be in a malformed state and will need to be manually deleted. There will be an error, but it should still delete successfully. |
| 22 | + |
| 23 | +## Incident details |
| 24 | + |
| 25 | +- **Initial detection:** Developers reported build errors on Discord |
| 26 | + - [Build broken](https://discord.com/channels/564160730845151244/1271849547814928464) |
| 27 | + - [Function Deployment not working](https://discord.com/channels/564160730845151244/1271868837343531038) |
| 28 | +- **Affected components:** Function creation and deployments resulted in errors |
| 29 | +- **User impact:** Some developers were unable to create a new functions or deploy existing functions |
| 30 | + |
| 31 | +## Root cause analysis |
| 32 | + |
| 33 | +After troubleshooting with developers who faced the problem, we were table to narrow down which projects had the problem so we could dig into the database and see what was wrong. |
| 34 | + |
| 35 | +After investigating the tables, we discovered the new `specification` attribute was missing from the `_metadata` entry. |
| 36 | + |
| 37 | +We added the `specification` attribute in a recent zero-downtime patch, but there was a bug where the `_metadata` record wasn't updated properly. Since the `specification` attribute was in the table, it was returned when the function was fetched from the database, but since it wasn't in the `_metadata` table, the subsequent [update function document](https://github.com/appwrite/appwrite/blob/e31bae7644e113153c552f184e89131479c43722/app/controllers/api/functions.php#L278) resulted in the "Invalid document structure" error. |
| 38 | + |
| 39 | +## Resolution and recovery |
| 40 | + |
| 41 | +- **Immediate actions:** No actions were taken to mitigate the problem |
| 42 | +- **Resolution:** To prevent the error from occurring, we: |
| 43 | + 1. Removed the attribute from the metadata of the 1 project that had it to make all projects consistent. |
| 44 | + 2. Dropped the column from the functions tables so that the attribute wouldn't be in the resulting document. |
| 45 | + 3. Flushed the cache to ensure the old `_metadata` and functions with the `specification` attribute were removed. |
| 46 | + |
| 47 | +## Lessons learned |
| 48 | + |
| 49 | +- **What went well:** [Incident](https://status.appwrite.online/incident/411901) was created to keep the community notified |
| 50 | +- **What could be improved:** |
| 51 | + - We only knew about this and dug into it after more than a handful of the community raised concerns |
| 52 | + - Better validation, logging, and testing of patch scripts |
| 53 | +- **Action items:** |
| 54 | + - Properly add the specification attribute |
| 55 | + |
| 56 | +## Additional resources |
| 57 | + |
| 58 | +- [Better Stack incident](https://status.appwrite.online/incident/411901) |
0 commit comments