Some image url used as src of <img> component is causing error

Author: jiaxiangchengCreated Feb 4, 2023Updated May 7, 2026
Labelsbug

Im using react + nextjs and I would like to take screenshot of my screen. "https://media.restocks.net/products/DV6773-220/a-ma-maniere-x-air-jordan-4-violet-ore-1-400.png" Any image url from the above domain used as "src" of the component will produce an error when I call toPng.

But image url from the following domain is working "https://images.stockx.com/images/Adidas-Yeezy-Boost-350-V2-Blue-Tint-Product.jpg?fit=fill&bg=FFFFFF&w=140&h=100&fm=webp&auto=compress&q=90&dpr=2&trim=color&updated_at=1606322199"

Expected Behavior

Download the following image as png image

Current Behavior

No image is downloaded and got this error. image

Possible Solution

If I use images from other domains it works and it can download the image. image If I use the from "next/image" it works with "https://media.restocks.net/products/DV6773-220/a-ma-maniere-x-air-jordan-4-violet-ore-1-400.png". But with from Chakra UI or the Native they don't work.

Steps To Reproduce

image
  1. Use "https://media.restocks.net/products/DV6773-220/a-ma-maniere-x-air-jordan-4-violet-ore-1-400.png" as src of the component.
  2. Take screenshot with toPng and download it with downloadjs
  3. Check the error on your console.

Additional Context

-How has this issue affected you? I can not take screenshot of any image. -What are you trying to accomplish? Understand why is not working with images sources from "media.restocks.net"

Your Environment

image The image domains are already in the whilelist of next.config.js

"react": "18.1.0", "next": "12.1.6",

  • html-to-image: 1.11.11
  • OS: macOS Ventura 13.2
  • Browser: Version 109.0.5414.119 (Official Build) (arm64)