attempt to got functions to deploy

This commit is contained in:
Kurt Hutten
2021-07-31 17:04:20 +10:00
parent 2497627c1d
commit 5c673a6a01

View File

@@ -1,6 +1,6 @@
import { builder } from '@netlify/functions' import { builder } from '@netlify/functions'
import type { HandlerResponse } from '@netlify/functions' import type { HandlerResponse } from '@netlify/functions'
import chromium from 'chrome-aws-lambda' const { headless, executablePath, puppeteer} = require('chrome-aws-lambda')
const captureWidth = 1200 const captureWidth = 1200
const captureHeight = 630 const captureHeight = 630
@@ -13,17 +13,17 @@ async function unwrappedHandler (event, context): Promise<HandlerResponse> {
const url = `${process.env.URL}/u${path}/social-card` const url = `${process.env.URL}/u${path}/social-card`
const browser = await chromium.puppeteer.launch({ const browser = await puppeteer.launch({
executablePath: process.env.URL?.includes('localhost') executablePath: process.env.URL?.includes('localhost')
? null ? null
: await chromium.executablePath, : await executablePath,
args: ['--no-sandbox','--disable-web-security','--disable-gpu', '--hide-scrollbars', '--disable-setuid-sandbox'], args: ['--no-sandbox','--disable-web-security','--disable-gpu', '--hide-scrollbars', '--disable-setuid-sandbox'],
// args: chromium.args, // args: chromium.args,
defaultViewport: { defaultViewport: {
width: captureWidth, width: captureWidth,
height: captureHeight + clipY height: captureHeight + clipY
}, },
headless: chromium.headless headless: headless
}) })
const page = await browser.newPage() const page = await browser.newPage()