Skip to content

Instantly share code, notes, and snippets.

@vbarbarosh
Last active April 19, 2019 17:01
Show Gist options
  • Select an option

  • Save vbarbarosh/3aafd76fc2ae59fd0b91fec5ca42ca01 to your computer and use it in GitHub Desktop.

Select an option

Save vbarbarosh/3aafd76fc2ae59fd0b91fec5ca42ca01 to your computer and use it in GitHub Desktop.
shell_docker_browserless_debug – Debugging Browserless https://codescreens.com
#!/bin/bash
# http://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -o nounset -o errexit -o pipefail
# Debugging Browserless
# -e DEBUG=browserless* print only browserless messages
# -e DEBUG=puppeteer* print only puppeteer messages
# -e DEBUG=* print all messages
docker run --rm -i -e DEBUG=browserless* browserless/chrome bash << 'EOF'
node build/index.js &
while ! curl -sf 127.0.0.1:3000/workspace -o /dev/null; do sleep 0.2s; done
curl -sf 127.0.0.1:3000/function -H Content-Type:application/javascript \
-o /dev/stdout --data-binary @- << 'EOF2'
module.exports = async function ({page}) {
await page.goto('https://youtube.com');
return {data: 'DONE\n'};
};
EOF2
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment