Skip to content

fix: Send entire JSON, to send the Content-Length header [DAT-818] - #10

Merged
thrau merged 2 commits into
mainfrom
DAT-818
Mar 2, 2026
Merged

fix: Send entire JSON, to send the Content-Length header [DAT-818]#10
thrau merged 2 commits into
mainfrom
DAT-818

Conversation

@kittylon

@kittylonkittylon commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Sending data as generators does not set the Content-Length header in the POST request, which is required by the Tinybird /v0/datasources endpoint. Hence, calling the method append_ndjson throws the following error:
Already reported by @Pive01 in this Slack thread.

[ERROR] ApiError: API Error (411): Add a valid Content-Length header containing the length of the message-body. Documentation: https://docs.tinybird.co/api-reference/api-reference.html#limits

Extra considerations:

  • All data sources do not get more than 100 records per day
  • The GitHub API caps the commit difference to 250 [1]
  • The /v0/datasources endpoint limit is at 5 times per minute [2]

Since we receive few records to iterate over, it makes sense to keep sending data in batches via the /v0/datasources endpoint. Once more data flows, we can consider the usage of the /v0/events endpoint + generators.

@kittylonkittylon changed the title fix: dump the entire data into one JSON, to send the Content-Length h…fix: Send entire JSON, to send the Content-Length headerMar 2, 2026
@kittylonkittylon added the bug Something isn't working label Mar 2, 2026
@kittylon
kittylon requested review from Pive01 and thrauMarch 2, 2026 17:11
@kittylonkittylon self-assigned this Mar 2, 2026
@kittylonkittylon changed the title fix: Send entire JSON, to send the Content-Length headerfix: Send entire JSON, to send the Content-Length header [DAT-818]Mar 2, 2026
@kittylon
kittylon marked this pull request as ready for review March 2, 2026 18:57

@thrauthrau left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! even though i did really like the iterator pattern 😁

thanks for fixing this so quickly and adding the test!

@thrau
thrau merged commit 5f9e732 into mainMar 2, 2026
5 of 7 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugSomething isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@kittylon@thrau