Open mflisikowski opened 1 year ago
Temp solution browserless docs
const browser = await puppeteer.connect({
browserWSEndpoint: 'wss://chrome.browserless.io?token=<your_token>',
});
const browser = await puppeteer.connect({
browserWSEndpoint: 'wss://browserless-production-XXXX.up.railway.app',
});
But... pdf generation is fails, only screenshot do the job correctly.
import puppeteer from 'https://deno.land/x/puppeteer@16.2.0/mod.ts';
import { serve } from 'https://deno.land/std@0.168.0/http/server.ts';
serve(async () => {
const browser = await puppeteer.connect({
browserWSEndpoint: 'wss://browserless-production-XXXX.up.railway.app',
// or
browserWSEndpoint: 'wss://chrome.browserless.io?token=<your_token>',
});
const page = await browser.newPage();
await page.goto('https://mflisikowski.dev/cv', {
waitUntil: 'networkidle2',
});
const screenshot = await page.screenshot();
await browser.close();
return new Response(screenshot, {
headers: { 'Content-Type': 'image/png' },
});
});
I'm having the same issue.
Even though I'm able to use puppeteer thanks to the browserless.io solution (thanks @mflisikowski!), still my puppeteer is not behaving as expected. I believe because it's not possible to run JS in browserless, and we should pass an extra arg, like:
await puppeteer.launch({
args: [
'--enable-features=ExperimentalJavaScript'
]
})
but it looks like it's not supported - see docs
(btw @mflisikowski the page you try to scrape in the example is not accessible https://mflisikowski.dev/cv)
yes, yes I know that this route does not exist (yet :)), locally generate pdf with 404, It is enough for me to test purpose :)
Also, I've realised that actually the experimental javascript flag is not needed as the js in my target page is actually being executed 😅
I found another solution I decided to leave the information here as well :) doppio.sh
Hi, I'm stuck looking for a browser version on my Apple M1 Pro, when I added the puppeteer package, I can't run Supabase function successfully anymore.
Deno info:
Error after call http://localhost:54321/functions/v1/:
Supabase function code, that try to run.