ebidel/try-puppeteer

try-puppeteer: (async() => { ... })() fails silently

ebidel opened this issue · 2 comments

From @ithinkihaveacat on November 2, 2017 12:33

The following code (abbreviated version of a file from the examples folder) fails silently when entered in the editing component at https://try-puppeteer.appspot.com/:

(async() => {
const browser = await puppeteer.launch();
console.log('Hello, World');
})();

Actual:

No output, no error message.

Expected:

The output Hello, World!.

Copied from original issue: puppeteer/puppeteer#1254

Ironically, this by itself works:

(async() => {
console.log('Hello, World');
})();

I think we can get around it by adding an await in front of the user code (https://github.com/ebidel/try-puppeteer/blob/master/backend/server.js#L85) just in case someone uses an async IIFE wrapper.

Unfortunately, that won't work if the user just has:

const browser = await puppeteer.launch();
...