Skip to content

Commit 0653b84

Browse files
authored
fix(function): get page with no default context (#625)
1 parent c693f31 commit 0653b84

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/function/src/template.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ module.exports = code => {
3131
async (url, browserWSEndpoint, opts) => {
3232
const puppeteer = require('@cloudflare/puppeteer')
3333
const browser = await puppeteer.connect({ browserWSEndpoint })
34-
const page = (await browser.pages())[1]
34+
const pages = await browser.pages()
35+
const page = pages[pages.length - 1]
3536
try {
3637
return await (${code})({ page, ...opts })
3738
} finally {

0 commit comments

Comments
 (0)