Skip to content

Failed the minimize CSS: Error: Protocol error (Emulation.setDeviceMetricsOverride) #340

Description

@homanp

Hi there @peterbe!

I'm trying to use your module with my own instance of puppeteer. My code looks like so:

'use strict'
const chrome = require('chrome-aws-lambda');
const puppeteer = require('puppeteer-core');
const miminalcss = require('minimalcss');

const url = 'https://www.google.com';
let minimalCss = '';

const browser = await puppeteer.launch({
	args: chrome.args,
	executablePath: await chrome.executablePath,
	headless: chrome.headless
});
 
miminalcss.minimize({urls: [url], browser})
	.then(result => {
		minimalCss = result.finalCss;
	})
	.catch(error => {
		console.error(`Failed the minimize CSS: ${error}`);
	});

ERROR:
RROR Failed the minimize CSS: Error: Protocol error (Emulation.setDeviceMetricsOverride): Session closed. Most likely the page has been closed.

DEPENDENCIES:

"chrome-aws-lambda": "^2.0.0",
"minimalcss": "^0.8.3",
"puppeteer-core": "^2.0.0",

Any ideas on what the issue might be? Seems like the connection is getting closed for some reason.

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions