So I built a two way sync and have it turned on for real time updates. When I edit a cell in the Coda table the log shows that it successfully updated the API (and the database on the other side shows the change", but I keep getting an error in the UI and it has the edited cell flagged: “Sending [redacted] failed: expected 1 rows but got 0”
Any thoughts on what i have setup wrong?
Hi @Ron_Gerrans3 - Are you making sure to return the “final” row at the end of the update?
// Return the final state of the task.
let updated = response.body;
Because updating a record can have side effects, we require that you return the final state of all updated rows at the end of the
Thanks @Eric_Koleda . I’ve tried a bunch of different changes to try to issolate, but am 95% sure I had the error with that in the mix. I did just put it back in and am now getting a new error in the UI “Sending [redacted] failed: Some results are missing their ID property” but the actual logs are showing success.
One other data point, is for both errors I do have a flag on the edited cell saying that the edits hadn’t been sent back yet, when they had as per the log files
I think both of these errors relate to Coda processing the response from your
executeUpdate function, so it makes sense that the HTTP request to the API would still be successful.
“Sending [redacted] failed: Some results are missing their ID property”
This error indicates that the value you returned for the final row is missing a value for the
idProperty defined in the schema. This value is required to update the correct row in the sync table. Check to make sure the row value you are returning has the corresponding field populated.
If you continue to run into issues feel free to book some 1:1 time with me during my open office hours:
I didn’t fully understand the flow of the update coming back and overwriting the row that was edited so it didn’t match the one-off json that I had to build in creating the sync table in the initial ‘execute’ function (the api I’m using doesn’t have a list function, so I have to do a “search” that returns all rows plus have the complexity of having to map sub-objects back up to the top level in my sync table)
Now that I mapped the result from the
executeUpdatefunction to match the same format as my original
execute function to build the table, it all works!!!
Nice! Glad to hear you got that working. Let me know if there are places in the documentation or sample code I could add more information to make this requirement clearer.