Deployed, everything worked -- but after some time I am seeing this:
@serverless-chrome/lambda: Error trying to spawn chrome: { Error: Command failed: mktemp -d -t chrome.XXXXXXX
mktemp: failed to create directory via template ‘/tmp/chrome.XXXXXXX’: No space left on device
at checkExecSyncError (child_process.js:481:13)
at Object.execSync (child_process.js:521:13)
at makeTempDir (/var/task/node_modules/@serverless-chrome/lambda/dist/bundle.cjs.js:39:24)
at Launcher.prepare (/var/task/node_modules/@serverless-chrome/lambda/dist/bundle.cjs.js:108:52)
at /var/task/node_modules/@serverless-chrome/lambda/dist/bundle.cjs.js:246:16
at throw (native)
at step (/var/task/node_modules/@serverless-chrome/lambda/dist/bundle.cjs.js:69:193)
at /var/task/node_modules/@serverless-chrome/lambda/dist/bundle.cjs.js:69:404
at process._tickDomainCallback (internal/process/next_tick.js:135:7)
error: null,
cmd: 'mktemp -d -t chrome.XXXXXXX',
file: '/bin/sh',
args: [ '/bin/sh', '-c', 'mktemp -d -t chrome.XXXXXXX' ],
options:
{ shell: true,
file: '/bin/sh',
args: [ '/bin/sh', '-c', 'mktemp -d -t chrome.XXXXXXX' ],
Looks like some cleanup is not happening?
(The lambda is kept warm by frequent usage)
"@serverless-chrome/[email protected]":
version "1.0.0-53"
EDIT: Hmm, I do see there is code that should perform that cleanup, but I guess something prevents it from being reached.
Random idea: rm -rf /tmp/chrome.??????? on startup? (instead of at the end of the lambda invocation)
After adding some logging to list everything there is in /tmp, it looks like it's not the user data dir after all:
"core.headless-chromi.14",
"core.headless-chromi.172",
"core.headless-chromi.213",
"core.headless-chromi.253",
"core.headless-chromi.296",
"core.headless-chromi.336",
"core.headless-chromi.376",
"core.headless-chromi.415",
"core.headless-chromi.451",
"core.headless-chromi.492",
Seeing lots of core dumps which accumulate.
From a quick google I got to https://github.com/GoogleChrome/puppeteer/issues/1791, but I can't see anything useful, except deleting the core files.
@emilburzo do you find something useful ? I've got the same error after some use... Thanks
@2803media nothing to actually fix the root problem
but running rm -rf /tmp/core.* after each chrome kill is a good enough compromise for me, things are finally stable now
Thanks @emilburzo for this info, Yesterday I added this to my function, I hope it will temporary solve this problem:
'use strict';
const puppeteer = require('puppeteer');
const exec = require('child_process').exec;
module.exports.index = async (event, context) => {
exec('rm -r /tmp/core.* || true', function(err,stdout,stderr){
if(err)
console.log('Directory Empty', err);
else
console.log("Files Deleted");
});
// some code
}
I ran into this issue as well after months of use. The above code from 2803media worked locally - so I will try it deployed and hopefully it will keep this issue at bay.
Most helpful comment
Thanks @emilburzo for this info, Yesterday I added this to my function, I hope it will temporary solve this problem: