Skip to content

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

Merged
thrau merged 2 commits intomainfrom
DAT-818
Mar 2, 2026
Merged

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

Conversation

@kittylon
Copy link
Contributor

@kittylon kittylon commented Mar 2, 2026

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.

@kittylon kittylon 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 header Mar 2, 2026
@kittylon kittylon added the bug Something isn't working label Mar 2, 2026
@kittylon kittylon requested review from Pive01 and thrau March 2, 2026 17:11
@kittylon kittylon self-assigned this Mar 2, 2026
@kittylon kittylon changed the title fix: Send entire JSON, to send the Content-Length header fix: 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
Copy link
Member

@thrau thrau left a comment

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 main Mar 2, 2026
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants