async function inside evaluate fails
Are you transforming your code with babel? The babel async function code isn’t compatible with Puppeteer. We call function.toString and send your code into Chromium, but babel messes with that and we end up sending an incomplete string. You can get around this by using template strings instead of functions.1
2
3await page.evaluate(`(async() => {
console.log('1');
})()`);