The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
added Puppeteer example
Lakshan Pererae198aba00eb9
diff --git a/examples/edge-functions/supabase/functions/puppeteer/README.md b/examples/edge-functions/supabase/functions/puppeteer/README.mdnew file mode 100644index 00000000000..7ce1d6a7628--- /dev/null+++ b/examples/edge-functions/supabase/functions/puppeteer/README.md@@ -0,0 +1,11 @@+# Using Puppeteer++This example shows how you can use Puppeteer and a headless-browser to generate screenshots of a web page. Pass the `url` of the web page as a query string.++Since Edge Functions cannot run a Headless Browser instance due to resource constraints, you will need to use a hosted browser service like https://browserless.com.++## Deploy++```bash+supabase functions deploy puppeteer --no-verify-jwt+```diff --git a/examples/edge-functions/supabase/functions/puppeteer/index.ts b/examples/edge-functions/supabase/functions/puppeteer/index.tsnew file mode 100644index 00000000000..7eac140f29f--- /dev/null+++ b/examples/edge-functions/supabase/functions/puppeteer/index.ts@@ -0,0 +1,25 @@+import { serve } from 'https://deno.land/[email protected]/http/server.ts'+import puppeteer from 'https://deno.land/x/[email protected]/mod.ts'++serve(async (req) => {+ try {+ // Visit browserless.io to get your free API token+ const browser = await puppeteer.connect({+ browserWSEndpoint: 'wss://chrome.browserless.io?token=YOUR_API_TOKEN',+ })+ const page = await browser.newPage()++ const url = new URL(req.url).searchParams.get('url') || 'http://www.example.com'++ await page.goto(url)+ const screenshot = await page.screenshot()++ return new Response(screenshot, { headers: { 'Content-Type': 'image/png' } })+ } catch (e) {+ console.error(e)+ return new Response(JSON.stringify(`Error occurred when generating the screenshot`), {+ headers: { 'Content-Type': 'application/json' },+ status: 500,+ })+ }+})