Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const createChromeAWSLambdaRenderer = () => async event => {
const command = commands[event.command];
if (!command) {
throw serializeError(new Error(`Unknown command "${event.command}"`));
}
const target = createChromeAppTarget({
baseUrl: event.baseUrl,
});
try {
await target.start({
chromeFlags: chromium.args,
chromePath: await chromium.executablePath,
});
return await command(target, event);
} catch (error) {
throw serializeError(unwrapError(error));
} finally {
await target.stop();
}
};