BackstopJS Docker Image and ERR_NETWORK_CHANGED

Home » BackstopJS Docker Image and ERR_NETWORK_CHANGED
container ship, container transport, seagoing vessel-6631117.jpg

I am running backstopjs in a docker image and I kept getting:

Browser Console Log 0: JSHandle:JQMIGRATE: Migrate is installed, version 3.3.2
Puppeteer encountered an error while running scenario "Homepage"
Error: net::ERR_NETWORK_CHANGED at https://www.site.com
Puppeteer encountered an error while running scenario "Homepage"
Error: net::ERR_NETWORK_CHANGED at https://www.site.com
Puppeteer encountered an error while running scenario "firm"
Error: net::ERR_NETWORK_CHANGED at https://www.site.com/our-firm/overview/
Browser Console Log 0: JSHandle:BackstopTools have been installed.

I couldn’t really proceed because this was holding me up. I went down the rabbit whole of looking into backstopjs and found the solution on the puppeteer docker page:

If you’re seeing random navigation errors (unreachable url) it’s likely due to ipv6 being enabled in docker. Navigation errors are caused by ERR_NETWORK_CHANGED (-21) in chromium. Disable ipv6 in your container using --sysctl net.ipv6.conf.all.disable_ipv6=1 to fix:

So all I had to do was change my alias to this:

alias backstop='docker run --sysctl net.ipv6.conf.all.disable_ipv6=1 --rm -v $(pwd):/src backstopjs/backstopjs:6.0.4 "$@"'

And Viola – it started working.

Leave a Comment

Your email address will not be published. Required fields are marked *