This could be a bug upstream.
Would appreciate a work around for a temporary fix.
\\ the load-fail event
{ method: 'Network.loadingFailed',
params:
{ requestId: '12.1',
timestamp: 2438.844368,
type: 'Font',
errorText: 'net::ERR_INSUFFICIENT_RESOURCES',
canceled: false }
}
\\ its response-received event
{ method: 'Network.responseReceived',
params:
{ requestId: '12.1',
loaderId: '8792DFA0E7823FF1218163603A2EC43A',
timestamp: 2438.844087,
type: 'Font',
response:
{ url: 'https://fonts.gstatic.com/s/opensans/v15/cJZKeOuBrn4kERxqtaUH3aCWcynf_cDxXwCLxiixG1c.ttf',
status: 200,
statusText: '',
headers: [Object],
mimeType: 'font/ttf',
requestHeaders: [Object],
connectionReused: false,
connectionId: 9,
remoteIPAddress: '216.58.211.163',
remotePort: 443,
fromDiskCache: false,
fromServiceWorker: false,
encodedDataLength: 332,
timing: [Object],
protocol: 'h2',
securityState: 'secure',
securityDetails: [Object] },
frameId: '10EBE228849E0AC2C39E3C70643F45F' } }
\\its request
{ method: 'Network.requestWillBeSent',
params:
{ requestId: '12.1',
loaderId: '8792DFA0E7823FF1218163603A2EC43A',
documentURL: 'about:blank',
request:
{ url: 'https://fonts.gstatic.com/s/opensans/v15/cJZKeOuBrn4kERxqtaUH3aCWcynf_cDxXwCLxiixG1c.ttf',
method: 'GET',
headers: [Object],
mixedContentType: 'none',
initialPriority: 'VeryHigh',
referrerPolicy: 'no-referrer-when-downgrade' },
timestamp: 2438.800811,
wallTime: 1523612681.8526,
initiator: { type: 'parser', url: 'about:blank', lineNumber: 204 },
type: 'Font',
frameId: '10EBE228849E0AC2C39E3C70643F45F' } }
This errors are not seen with the @serverless-chrome/[email protected] but are happenning when I set HTML using Page.setDocumentContent in recent versions.
I am attaching the HTML as a txt that is encountering the problem as well.
My lambda which is triggering the errors looks like this
const chromeParams = {
flags: [
'--window-size=595x842',
'--hide-scrollbars'
]
};
const chrome = await launchChrome(chromeParams);
const tab = await CDP.New();
const client = await CDP({
target: tab.id
});
const {
Page,
Animation,
Network
} = client;
await Page.enable();
await Animation.enable();
await Network.enable();
const pageContent = Page.getResourceTree();
const htmlOptions = {
frameId: pageContent.frameTree.frame.id,
html: HTML
};
await Page.setDocumentContent(htmlOptions);
await Page.loadEventFired();
Not sure if what I'm encountering is related or not but I get Failed Provisional Load: [url], error_code: -12, error_description: , showing_repost_interstitial: 0, frame_id: 6 which seems to also map to insufficient resources in https://cs.chromium.org/chromium/src/net/base/net_error_list.h
This is when I load a page (any page) via Page.navigate({ url: [url] });
This is a "verbose" message but does result in the page not actually showing anything .
I am launching Chrome with the following parameters:
--disable-gpu
--window-size=1280,1696
--no-sandbox
--user-data-dir=/tmp/user-data
--hide-scrollbars
--enable-logging
--log-level=0
--v=99
--single-process
--data-path=/tmp/data-path
--ignore-certificate-errors
--homedir=/tmp
--disk-cache-dir=/tmp/cache-dir
--disable-setuid-sandbox
--remote-debugging-port=9222
I've tried deploying this on an AWS node.js 8.10 runtime
I will play around with the arguments and the runtime a little bit and update if I have any success.
@apokryfos I had no problems with the HTML when I tried this locally on headless chrome for mac os. Everything worked as I expected it to. But, I encounter this after I deploy to lambda.
@srihari93 Yes this is exactly what I am experiencing too. In fact I am using Ubuntu 16.04 and am able to run the actual binary that then gets uploaded to lambda.
The binary is working fine in on Ubuntu, but does not work on Lambda.
It seems to be something introduced in Chromium 65+
hey :)
Any success overcoming this issue?
@Bnaya The only way around so far is to use the older version @serverless-chrome/[email protected]. Unfortunately, I do not have the resources and time to invest more than filing this issue.
i've trying to create a failing test case
https://github.com/adieuadieu/serverless-chrome/pull/135
But i've encountered 2 problems. the test won't run npm install (need to figure where to add it)
And the test is on lambci docker, and not a real lambda. its very possible it will work there.
Update:
I've checked and found that adding --disable-dev-shm-usage arg fixing this issue
@Bnaya Yes that does seem to work for me as well . That's great news !
--disable-dev-shm-usage was added in v1.0.0-45. @srihari93 does it resolve your issue?
Closing as I believe the issue has been resolved.
Most helpful comment
@Bnaya Yes that does seem to work for me as well . That's great news !