I am running into an issue with PATCH requests on rows with my custom plugin. The sentry stack trace is here:
This issue is coming up as I’m upgrading my plugin from baserow 1.19.1 to 1.26.1.
I’m probably going to have to do some digging myself and perhaps debug. But I’d like some help understanding the intention of the code at baserow/contrib/database/ws/rows/signals.py:71
:
@receiver(row_signals.rows_updated)
def rows_updated(
sender,
rows,
user,
table,
model,
before_return,
updated_field_ids,
**kwargs,
):
table_page_type = page_registry.get("table")
before_rows_values = dict(before_return)[serialize_rows_values]
transaction.on_commit(
lambda: table_page_type.broadcast(
RealtimeRowMessages.rows_updated(
table_id=table.id,
serialized_rows_before_update=before_rows_values,
serialized_rows=get_row_serializer_class(
model, RowSerializer, is_response=True
)(rows, many=True).data,
metadata=row_metadata_registry.generate_and_merge_metadata_for_rows(
user, table, [row.id for row in rows]
),
),
getattr(user, "web_socket_id", None),
table_id=table.id,
)
)
am I understand correctly that this code is looking up the value for key “serialize_rows_value (the function)?” ? Wouldn’t it make more sense to have:
before_rows_values = dict(before_return)[serialize_rows_values()]
right now, the function is not found as a key in the dict, and hence the KeyError
exception.
I’m simply not understanding the intention here. @bram maybe you can help understand the intention of the code ?
It’s entirely possible that the serialization code for my custom field in my plugin is incorrect.
The custom field type in involved is LanguageField
here:
- baserow-vocabai-plugin/plugins/baserow_vocabai_plugin/backend/src/baserow_vocabai_plugin/fields/vocabai_models.py at main · Vocab-Apps/baserow-vocabai-plugin · GitHub
- baserow-vocabai-plugin/plugins/baserow_vocabai_plugin/backend/src/baserow_vocabai_plugin/fields/vocabai_fieldtypes.py at main · Vocab-Apps/baserow-vocabai-plugin · GitHub
I’m not expecting anyone to fully resolve this but I’d like a few pointers on where to look, I can do the deep dive debugging myself.