Permission error when trying to run a prerender server

When deploying a prerender server, it seems that the attempt to run the headless Chrome fails due to some permission (EACCES) error:

Dec 11 03:28:26 PM  ==> Starting service with 'npm start'
Dec 11 03:28:30 PM  
Dec 11 03:28:30 PM  > prerender-server@1.0.0 start
Dec 11 03:28:30 PM  > node index
Dec 11 03:28:30 PM  
Dec 11 03:28:32 PM  2022-12-11T13:28:32.954Z Starting Prerender
Dec 11 03:28:32 PM  2022-12-11T13:28:32.956Z Starting Chrome
Dec 11 03:28:33 PM  2022-12-11T13:28:33.052Z Prerender server accepting requests on port 10000
Dec 11 03:28:33 PM  node:events:491
Dec 11 03:28:33 PM        throw er; // Unhandled 'error' event
Dec 11 03:28:33 PM        ^
Dec 11 03:28:33 PM  
Dec 11 03:28:33 PM  Error: spawn /opt/render/project/.render/chrome/opt/google/chrome/ EACCES
Dec 11 03:28:33 PM      at Process.ChildProcess._handle.onexit (node:internal/child_process:285:19)
Dec 11 03:28:33 PM      at onErrorNT (node:internal/child_process:485:16)
Dec 11 03:28:33 PM      at processTicksAndRejections (node:internal/process/task_queues:83:21)
Dec 11 03:28:33 PM  Emitted 'error' event on ChildProcess instance at:
Dec 11 03:28:33 PM      at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
Dec 11 03:28:33 PM      at onErrorNT (node:internal/child_process:485:16)
Dec 11 03:28:33 PM      at processTicksAndRejections (node:internal/process/task_queues:83:21) {
Dec 11 03:28:33 PM    errno: -13,
Dec 11 03:28:33 PM    code: 'EACCES',
Dec 11 03:28:33 PM    syscall: 'spawn /opt/render/project/.render/chrome/opt/google/chrome/',
Dec 11 03:28:33 PM    path: '/opt/render/project/.render/chrome/opt/google/chrome/',
Dec 11 03:28:33 PM    spawnargs: [
Dec 11 03:28:33 PM      '--no-sandbox',
Dec 11 03:28:33 PM      '--headless',
Dec 11 03:28:33 PM      '--disable-gpu',
Dec 11 03:28:33 PM      '--remote-debugging-port=9222',
Dec 11 03:28:33 PM      '--hide-scrollbars'
Dec 11 03:28:33 PM    ]
Dec 11 03:28:33 PM  }

The source code can be found here:

The attempted “chromeFlags” are from the following issue:

Locally everything works perfectly (by commeting the “chromeLocation” option and letting the package automatically detect the installed Chrome path).

What can I do to solve this?

HI there,

Thanks for reaching out.

I think your chromeLocation may be incorrect. I think it’s expects the binary, not a path, e.g.:

chromeLocation: '/opt/render/project/.render/chrome/opt/google/chrome/chrome'

Hope that helps

Alan

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.