-
Notifications
You must be signed in to change notification settings - Fork 478
Open
Description
What’s happening
Calling collection.add_row() is blowing up with a 500 from /api/v3/submitTransaction.
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: https://www.notion.so/api/v3/submitTransaction
Raw response:
{
"errorId": "07f2cd70-71ec-422e-9b41-4706f4d5a240",
"name": "CrdtAssertionError",
"clientData": {
"type": "unsaved_transactions",
"errors": [
{
"id": "f71a385f-645f-4ad0-9412-78c0394920a1",
"name": "CrdtAssertionError",
"retryable": false
}
],
"untried": []
},
"debugMessage": "Unsaved transactions: Space that has CRDT enabled should have crdt blocks",
"message": "Something went wrong. (500)"
}Code
from notion.client import NotionClient
from dotenv import load_dotenv
import os
load_dotenv()
client = NotionClient(token_v2=os.getenv("NOTION_TOKEN_A"))
cv_page = client.get_block(os.getenv("NOTION_URL_A")) # DB page URL
cv = cv_page.collection
row = cv.add_row()
row.title = "Just some data"What I found
The create_record() method builds an args dict for the set operation but it doesn’t include space_id.
When I add that field, Notion happily generates the CRDT metadata and the call succeeds.
Patch (in client.py, ~line 370):
args = {
"id": record_id,
"version": 1,
"alive": True,
"created_by_id": self.current_user.id,
"created_by_table": "notion_user",
"created_time": now(),
"parent_id": parent.id,
"parent_table": parent._table,
"crdt_format_version": 1,
"space_id": self.current_space.id, # ← missing
"crdt_data": { ... }
}Does that fix line up with what you’re seeing?
If you can reproduce the 500 and this one-liner solves it, I can send a PR. Let me know what you think!
itsvlch and unyacat
Metadata
Metadata
Assignees
Labels
No labels