
Back to the Future: Revamped Blog Images and Enhanced Error Logging
Back to the Future: Revamped Blog Images and Enhanced Error Logging
Hey there, code wizards and digital pioneers! Guess what? We've rolled out some cool updates to make your crypto settlement experience even smoother on PayDirect. From glitch-free hero images to mega-reliable error logs, we've been cooking up a storm behind the keyboard. Intrigued? Let's dive in!
Picture This: Blog Image Backfill
First up in this release, we're talking images. Remember when you visited a blog, and the image was as blank as a fresh Git commit? Not anymore! The new backfill-blog-images.ts script is here to save the day. This script ensures every post gets its hero image — because who doesn't love dazzling visuals? 😎
A New Script in Town
Here's a sneak peek into our newly baked script:
import "dotenv/config"
import { neon } from "@neondatabase/serverless"
import { generateBlogHeroImage, isPersistedBlogImage } from "../lib/blog-image"
async function main() {
const sql = neon(process.env.DATABASE_URL!)
const posts = await sql`
SELECT id, slug, title, image_url
FROM blog_posts
ORDER BY created_at DESC
`
// Loop through posts to generate images
for (const post of posts) {
if (isPersistedBlogImage(post.image_url)) {
console.log(`[skip] ${post.slug}`)
continue
}
const result = await generateBlogHeroImage(post.title, post.slug)
if (!result.url) {
console.error(`[fail] ${post.slug}: ${result.error}`)
continue
}
console.log(`[ok] ${post.slug}`)
}
}
main().catch((err) => {
console.error(err)
process.exit(1)
})
The script efficiently backfills those empty image slots with stunning hero images. It checks if an image already exists by calling isPersistedBlogImage. If not, it uses generateBlogHeroImage to create one. This way, every blog post shines with its unique visual charm.
Error Logging Level Up
Now, let's shift gears to error logging. Because, let's face it, errors happen, but they shouldn't bog you down. Our recent tweaks in lib/blog-image.ts ensure you get the full error story, whether it's a straightforward message or a cryptic object message.
More Than Just a Console Log
Check out the new error handling logic:
lastError =
err instanceof Error
? err.message
: typeof err === "object" && err !== null && "message" in err
? String((err as { message: unknown }).message)
: JSON.stringify(err)
console.error(`[BLOG-IMAGE] ${model} attempt ${attempt}/${retries} failed for "${slug}":`, lastError)
We've spiced up our error logging, making the error messages as easy to decipher as your favorite meme. By capturing the essence of both known and unknown error types, we're upping the ante on debugging.
Why It Matters
These improvements aren't just for show. Having hero images ready enhances the visual engagement of our blog, making your reading experience a total treat. Plus, with rock-solid error logging, you can now spend less time hunting down issues and more time building cool stuff.
A Call to Action
Eager to see these updates in action? Check out our documentation for more insights. Keep those keyboards clacking, and the code rolling, because with PayDirect, the future of crypto settlement is not just promising—it's happening now. Stay classy, developers! 🖥️
Remember, your feedback is as precious as Bitcoin in 2011, so keep it coming. Catch you in the next update!
Tip the Author
Powered by PayDirect on Base
Enjoyed this post? Send a tip using crypto. We eat our own dog food.
More from PayDirect

Leveling Up Our Blog Imagery: Switching to GPT Image for Seamless Hero Shots
Jun 25

Leveling Up Your Blogging Game with New Image Regeneration Features!
Jun 25

Unlock Seamless Payments: Meet the new Coinbase Agentic Wallet Integration on PayDirect
Jun 25

Revving Up the PayDirect Engine: Say Hello to Workspace Dependencies!
Jun 19
Powered by ContentAgent
