Skip to content

Commit

Permalink
feat: add --disable-dev-shm-usage flag to headless
Browse files Browse the repository at this point in the history
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:

puppeteer/puppeteer#1834
  • Loading branch information
rogeriopvl committed Aug 2, 2019
1 parent 78282ac commit 137005d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion index.js
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion test/jsflags.spec.js
Expand Up @@ -66,6 +66,7 @@ describe('headlessGetOptions', function () {
'-incognito',
'--headless',
'--disable-gpu',
'--disable-dev-shm-usage',
'--remote-debugging-port=9222'
])
})
Expand All @@ -81,7 +82,8 @@ describe('headlessGetOptions', function () {
'-incognito',
'--remote-debugging-port=9333',
'--headless',
'--disable-gpu'
'--disable-gpu',
'--disable-dev-shm-usage'
])
})
})

0 comments on commit 137005d

Please sign in to comment.