Sitemap

Member-only story

My Publishing Bot Reported Success. The Story Was Still a Draft.

3 min read1 day ago

--

Five bugs from automating a web editor, including one I misdiagnosed, and the rule that catches them all

The log said “Done. Published.” I opened my Medium stories list to look at the new post. It wasn’t there. It was sitting in Drafts, and my bot’s database said it was a success.

I had written a bot that drives Medium’s editor with Playwright: it opens a new story, pastes the text, adds topics, and clicks Publish. Parts of it had been failing quietly for weeks (my history table showed nearly two hundred failed attempts, none of which I had noticed). Here are the five bugs that taught me the most, in the order I found them.

1. “Success” that wasn’t

After clicking the final Publish button, my code read the story’s URL to confirm it worked. If the expected URL didn’t appear, it fell back to “any link on the page that points to the site”.

That link turned out to be the New story button in the navigation bar. The bot logged “Done. Published: https://…/new-story” and recorded a successful publish in its history. The story was still sitting in drafts.

Fix: a published story’s short URL redirects to its permanent address, and a draft’s does not. The bot now opens the short URL and demands the redirect. If it can’t confirm, it raises an error instead of guessing.

2. The check that ran too early

--

--

Coding Guy
Coding Guy

Written by Coding Guy⁠

I love to dig up deep into software, I am an IIT Delhi Graduate with 8 years into coding