This pipeline powers Canva preview images for House Updates via /api/canva-image.

How it works

When an update includes a Canva link, the site requests:

/api/canva-image?url=<canva-public-url>

The Pages Function attempts:

  1. Extracting a preview image from Canva HTML
  2. Falling back to a screenshot service if the HTML is dynamic

Setup options

Option 1: No setup (basic)

The function attempts to extract images directly from Canva HTML. This works for some designs but fails for JavaScript-rendered pages.

Configure a screenshot API for reliable previews.

Example provider: htmlcsstoimage.com

Steps:

  1. Create an account and get API credentials
  2. Add the credentials as runtime environment variables in Cloudflare Pages
  3. Confirm /api/canva-image calls the screenshot API when extraction fails

Operational notes

  • Use runtime environment variables in Cloudflare Pages, not build-time vars.
  • Ensure Canva links are public and accessible without authentication.