Back to DevLog

Why grep couldn't find the broken Amazon ASIN in the newsletter

2 min read

The newsletter linked to a dead Amazon product page. I grepped the entire repo for the ASIN and got nothing.

The broken ASIN was never written down. The newsletter used an affiliate short link that redirected to it. amzn.to/3OH1e5m returned a 301 to amazon.com/dp/B0GQPP6DS1, which 404'd. Grepping for B0GQPP6DS1 returned exit code 1 across dev, prod, backups, and logs.

The book block lives in SendGrid

The FROM THE CREATOR block wasn't in the Python code. I pulled the active SendGrid template via the API. Template d-fe476d0b2ef44425a07c5c7e2ad95577, version v6-light-only-clean, contained the book titles, prices, and four amzn.to links. auto_newsletter.py passes only briefing number, date, subject, content, and unsubscribe URL. No book data.

Both UNSEALED links in the template were wrong. The title linked to amzn.to/47dDdcj, which redirected to B0GQP2YGKZ. Neither short link appeared in any file in the repo.

Fixed the Python copy

I updated scripts/send_books_newsletter.py with the correct ASINs: B0DH65P3PT for Kindle and B0GVYL1T9S for paperback. Removed the nonexistent "2nd Edition" from the title and stripped the drifting price strings. Seven guarded replacements, each asserted to match exactly one occurrence.

Used direct amazon.com/dp/ links instead of generating new short links. This drops the tag=cwaffiliatein-20 affiliate tag the old short links carried.

Cron runs from prod

The newsletter cron is 0 9 * * 1,4 and runs from /home/epsteinscan/app, not app-dev. The fix is uncommitted on dev, waiting for confirmation of the rendered block. After commit, it needs promotion to prod or Monday's send will still use the stale copy.

I didn't run auto_newsletter.py --preview. Preview prints only the AI-generated content body. SendGrid applies the template wrapper server-side at send time, so preview cannot render the FROM THE CREATOR block.

Amazon blocked verification

I couldn't verify any ASIN. Amazon served a block page to all five /dp/ fetches, even with a browser User-Agent. Every ASIN judgment came from redirect targets, not loaded product pages.

Share this post