← Statpro dev log

Six accepted posts and zero published

#automation#sports#product

Two nearly identical slides side by side with matching header lines joined by thin connectors; only the pixel grid differs, dim on the left and glowing amber on the right

Every night Statpro, my sports stats and betting-research site, renders the best NBA performances into photo slideshows and posts them to TikTok as promotion. For days TikTok's API accepted every one, and nothing appeared. No error and no rejection, only six accepted posts sitting in a queued state that never turned into a live post.

So I stopped theorizing and did something embarrassingly simple. I listed every difference against a request that works, then removed them one at a time. The working request belongs to Binderdex, my trading-card app, which posts TikTok slideshows constantly.

The obvious suspects were innocent

  • Settings: one toggle differed. Mine now matches the working request exactly.
  • Title: the working request strips hashtags, because TikTok shows the title over the photos and never finished publishing one with a # in it. Mine read "#1 scored 15". It's "No. 1 scored 15" now.
  • Caption: mine carried a link, an App Store line and a 21+ responsible-gambling notice. A switch for posting a short caption now exists for tests.

Each fix shipped, each test post was accepted, and none published.

The last difference was the pixels

Once every request field matched, one difference was left: the images. The working pipeline re-encodes every slide with a battle-tested encoder at quality 92. Mine shipped the raw JPEG output of the engine that renders the slides. The fix is two lines:

// render the still as PNG, then re-encode like the working pipeline
const png = await renderStill(scene);
await sharp(png).jpeg({ quality: 92 }).toFile(slidePath);

I'm writing this before I know. If the next slideshow publishes, the encoding was the cause.

What the hunt left behind

The debugging paid for itself in tools. A failed post can be re-run as a GitHub workflow, with a duplicate guard that refuses a caption opening already seen on that channel. A status viewer lists recent posts per platform with state, error and live URL.

When a third-party API accepts a request and never completes it, compare every field with a request that works, pixels included. Same settings, title and caption isn't the same request until the bytes match too.

This is the build log for Statpro (statpro.io) · All entries · Weekly essays