Closed jpvalery closed 5 years ago
🤔 Maybe I can reuse what's been built here https://github.com/ianwalter/puppeteer?
@ianwalter hi! hope you're alright. I saw you ran into a similar issue with puppeteer and built an action that works around. Do you think your solution could apply here? Thanks in advance for your help :)
Reply from Percy:
Hi Jp!
Percy uses a Puppeteer browser for asset-discovery while uploading your snapshots. For CI systems, you'll need to use a container with Chrome installed, or install Chrome using some script. I think with GitHub actions, you can specify a docker image to use. You could use an image with pre-built browsers like this:
uses: docker://circleci/node:lts-browsers
Will try this
MVP Wil :) This fixed the issue!
Although I’m running into another error now… 😩
2019-10-09T15:35:23.4408115Z 📷 Snapshotting with Percy...
2019-10-09T15:35:28.4865982Z yarn run v1.17.3
2019-10-09T15:35:28.5183179Z warning Skipping preferred cache folder "/github/home/.cache/yarn" because it is not writable.
2019-10-09T15:35:28.5187844Z warning Selected the next writable cache folder in the list, will be "/tmp/.yarn-cache-3434".
2019-10-09T15:35:28.5295651Z $ /github/workspace/node_modules/.bin/percy snapshot
2019-10-09T15:35:28.6026082Z warning Cannot find a suitable global folder. Tried these: "/usr/local, /github/home/.yarn"
2019-10-09T15:35:31.1692925Z [[35mpercy[39m] created build #3: [34mhttps://percy.io/MontrealPhotoClub/website.en/builds/2780707[39m
2019-10-09T15:35:34.2478456Z [[35mpercy[39m] percy has started.
2019-10-09T15:35:34.2511135Z [[35mpercy[39m] serving static site at http://localhost:5339/
2019-10-09T15:35:38.2625524Z [[35mpercy[39m] Failed to navigate to http://localhost:5339/public/404.html, skipping. Error: Error: Protocol error (Page.navigate): Session closed. Most likely the page has been closed.
2019-10-09T15:35:38.2644424Z [[35mpercy[39m] Failed to inject agent JS: Error: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
2019-10-09T15:35:38.2651519Z [[35mpercy[39m] Failed to navigate to http://localhost:5339/public/index.html, skipping. Error: Error: Protocol error (Page.navigate): Session closed. Most likely the page has been closed.
2019-10-09T15:35:38.2661716Z [[35mpercy[39m] Failed to inject agent JS: Error: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
2019-10-09T15:35:38.2664930Z [[35mpercy[39m] Failed to navigate to http://localhost:5339/node_modules/eol/index.html, skipping. Error: Error: Protocol error (Page.navigate): Session closed. Most likely the page has been closed.
2019-10-09T15:35:38.2672897Z [[35mpercy[39m] Failed to inject agent JS: Error: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
2019-10-09T15:35:38.2679315Z [[35mpercy[39m] Failed to navigate to http://localhost:5339/node_modules/gatsby-graphiql-explorer/index.html, skipping. Error: Error: Protocol error (Page.navigate): Session closed. Most likely the page has been closed.
2019-10-09T15:35:38.2687462Z [[35mpercy[39m] Failed to inject agent JS: Error: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.
(Then it’s just a repeat through all node_modules)
The full workflow and logs are here https://github.com/MontrealPhotoClub/montrealphotoclub.en/pull/57/checks?check_run_id=253808696
Basically my workflow is to run yarn install > yarn build > my docker action which checks for percy_token, if percy is there, if the site has been built, and then run percy snapshot
Since everything else works great, I’m guessing I’m messing up somewhere and not running yarn percy snapshot in the correct folder?
Reply from Percy
The percy snapshot command defaults to the current directory. You'll probably want to use percy snapshot ./public so that only the build directory is snapshotted.
Although I'm not quite sure how that relates to that Protocol error that causes the Puppeteer session to close. If specifying that ./public directory doesn't help, I'll have to dig into the code to see what might be causing that. 🤔
Currently playing with the main.yml workflow in my test repo to see but will try this out right after
Error links to https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker since it's a docker file for GH actions, I linked to the direct section
Unless it's https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-on-alpine as the Dockerfile specifies
FROM node:10.14.1-alpine