Remove customer-og function (#3362)

* remove customer-og function

* puppeteer adj

* use specified browser revision
This commit is contained in:
Eli Kinsey
2022-04-26 06:52:55 -07:00
committed by GitHub
parent db4076e37d
commit 4548de287c
4 changed files with 8 additions and 157 deletions

View File

@@ -1,152 +0,0 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const chromium = require('chrome-aws-lambda')
exports.handler = async () => {
const browser = await chromium.puppeteer.launch({
args: chromium.args,
executablePath: process.env.NETLIFY_DEV ? undefined : await chromium.executablePath,
headless: chromium.headless,
})
const page = await browser.newPage()
const html = `<html>
<head>
<meta charset="utf-8" />
<style>
body {
background-color: #eeefe9;
font-family: "Arial", "Helvetica", "sans-serif";
overflow: hidden;
}
ul {
margin: 0;
list-style: none;
padding: 0;
}
ul li h3 {
margin: 0;
font-size: 22px;
white-space: nowrap;
line-height: 1.7;
margin: 14px 0px;
}
ul li h3 span {
opacity: 50%;
}
</style>
</head>
<body>
<section>
<div
style="
font-size: 32px;
padding: 38px 70px 28px;
font-weight: 600;
border-bottom: 2px dashed #d4d4d4;
"
>
<span style="opacity: 50%;">NEXT STEPS</span>
</div>
<div style="padding: 54px 70px">
<h1 id="title" style="font-size: 84px; margin: 0; line-height: 1">
Hey team! 👋
</h1>
<div style="display: flex; margin-top: 35px">
<div style="flex-shrink: 0">
<p
style="
max-width: 607px;
font-size: 42px;
margin: 0;
color: #2c2c2c;
line-height: 1.4;
"
>
Weve created this handy guide to answer common questions you or
your team may have.
</p>
</div>
<div
style="
margin-left: 46px;
background-color: #e5e7e0;
padding: 36px 40px;
border-radius: 6px;
"
>
<h2 style="font-size: 24px; opacity: 40%; margin: 0 0 25px">
CONTENTS
</h2>
<ul>
<li>
<h3>
Installing PostHog<span
>......................................................</span
>
</h3>
</li>
<li>
<h3>
Plans & pricing<span
>......................................................</span
>
</h3>
</li>
<li>
<h3>
How teams are using PostHog<span
>......................................................</span
>
</h3>
</li>
<li>
<h3>
Popular tutorials<span
>......................................................</span
>
</h3>
</li>
<li>
<h3>
Learn more about PostHog<span
>......................................................</span
>
</h3>
</li>
</ul>
</div>
</div>
</div>
</section>
</body>
</html>
`
await page.setContent(html, {
waitUntil: ['domcontentloaded'],
})
await page.evaluateHandle('document.fonts.ready')
await page.setViewport({
width: 1200,
height: 630,
})
const buffer = await page.screenshot({
type: 'jpeg',
})
await browser.close()
return {
statusCode: 200,
headers: {
'Content-Type': 'image/jpeg',
},
body: buffer.toString('base64'),
isBase64Encoded: true,
}
}

View File

@@ -146,10 +146,13 @@ module.exports = exports.onPostBuild = async ({ graphql }) => {
encoding: 'base64',
})
const browserFetcher = chromium.puppeteer.createBrowserFetcher()
const revisionInfo = await browserFetcher.download('982053')
const browser = await chromium.puppeteer.launch({
args: chromium.args,
executablePath: await chromium.executablePath,
headless: chromium.headless,
args: await chromium.args,
executablePath: revisionInfo.executablePath || process.env.PUPPETEER_EXECUTABLE_PATH,
headless: true,
})
const page = await browser.newPage()
await page.setViewport({

View File

@@ -1150,7 +1150,7 @@
to = "/tutorials/how-to-segment-users"
[build]
command = "AWS_LAMBDA_FUNCTION_NAME=trickpuppeteer GATSBY_DEPLOY_PRIME_URL=$DEPLOY_PRIME_URL gatsby build"
command = "GATSBY_DEPLOY_PRIME_URL=$DEPLOY_PRIME_URL gatsby build"
# Added: 2022-02-03
[[redirects]]

View File

@@ -50,7 +50,7 @@ export default function NextSteps({ location }) {
return (
<div style={{ opacity: loading ? '0' : '1' }}>
<Layout crumbs={[{ title: 'Next steps' }]}>
<SEO title="Next Steps - PostHog" image="/.netlify/functions/customer-og.js" />
<SEO title="Next Steps - PostHog" />
<div className="px-5 max-w-[600px] mx-auto">
<div className="flex justify-center items-center my-16 space-x-4 transition-opacity">
<Logo noText />