docker run -p 3000:3000 --name puppeteer philiplehmann/puppeteer:latest
curl -X POST \
-H 'content-type: application/json' \
--data '{"url":"https://google.com"}' \
'http://localhost:3000/'
or
curl -X POST \
-H 'content-type: application/json' \
--data '{"url":"https://google.com"}' \
'http://localhost:3000/pdf'
curl -X POST \
-H 'content-type: application/json' \
--data '{"html":"<h1>title</h1>"}' \
'http://localhost:3000/'
or
curl -X POST \
-H 'content-type: application/json' \
--data '{"html":"<h1>title</h1>"}' \
'http://localhost:3000/pdf'
curl -X POST \
-H 'content-type: application/json' \
--data '{"url":"https://google.com"}' \
'http://localhost:3000/image'
curl -X POST \
-H 'content-type: application/json' \
--data '{"html":"<h1>title</h1>"}' \
'http://localhost:3000/image'
all the puppeteer props to create a pdf are supported except the path https://devdocs.io/puppeteer/index#pagepdfoptions
to allow to run in emulation, some settings are needed to not run into errors:
using docker desktop it only supports 32-bit emulation and resolves in error:
Failed to launch the browser process!
The hardware on this system lacks support for the sse3 instruction set.
The upstream chromium project no longer supports this configuration.
For more information, please read and possibly provide input to their
bug tracking system at http://crbug.com/1123353
to get 64-bit support i could start it with colima:
brew install colima
colima start --arch x86_64 --cpu 4 --memory 16
- HTTP 3000
start puppeteer server, will be on port 3000
PUPPETEER_EXECUTABLE_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" yarn nx serve puppeteer
run *-local tests
# run playwright ui tests
TEST_SERVER_RUNNER=local yarn nx e2e-local puppeteer
# run vitest
TEST_SERVER_RUNNER=local yarn nx vitest-local puppeteer
# run both, e2e and vitest
TEST_SERVER_RUNNER=local yarn nx test-local puppeteer
´´´