From 137005d90e1e9e3f4acf0c86beb69805fb09a16d Mon Sep 17 00:00:00 2001 From: rogeriopvl Date: Fri, 2 Aug 2019 10:42:23 +0100 Subject: [PATCH] feat: add --disable-dev-shm-usage flag to headless This flag solves some issues when running chrome headless inside docker. For more details check this puppeteer issue where they discuss adding the flag to the default options as well: https://github.com/GoogleChrome/puppeteer/issues/1834 --- index.js | 6 +++++- test/jsflags.spec.js | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index b45b51f..4786a1f 100644 --- a/index.js +++ b/index.js @@ -167,7 +167,11 @@ ChromeBrowser.prototype = { ChromeBrowser.$inject = ['baseBrowserDecorator', 'args'] function headlessGetOptions (url, args, parent) { - var mergedArgs = parent.call(this, url, args).concat(['--headless', '--disable-gpu']) + var mergedArgs = parent.call(this, url, args).concat([ + '--headless', + '--disable-gpu', + '--disable-dev-shm-usage' + ]) var isRemoteDebuggingFlag = function (flag) { return flag.indexOf('--remote-debugging-port=') !== -1 diff --git a/test/jsflags.spec.js b/test/jsflags.spec.js index 0998d51..0b2c623 100644 --- a/test/jsflags.spec.js +++ b/test/jsflags.spec.js @@ -66,6 +66,7 @@ describe('headlessGetOptions', function () { '-incognito', '--headless', '--disable-gpu', + '--disable-dev-shm-usage', '--remote-debugging-port=9222' ]) }) @@ -81,7 +82,8 @@ describe('headlessGetOptions', function () { '-incognito', '--remote-debugging-port=9333', '--headless', - '--disable-gpu' + '--disable-gpu', + '--disable-dev-shm-usage' ]) }) })