Failed to launch the browser process no usable sandbox



  • to generate a report im using jsreport-core with chrome-pdf receipe, in azure vm im facing the below error when i tried to generate the report

    Error: Failed to launch the browser process!
    [1109/182146.276783:FATAL:zygote_host_impl_linux.cc(127)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/main/docs/linux/suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.
    TROUBLESHOOTING: https://pptr.dev/troubleshooting at Interface.onClose (/home/azureuser/garuda/garuda-be/node_modules/@puppeteer/browsers/src/launch.ts:383:11)
    at Interface.emit (node:events:525:35)
    at Interface.close (node:internal/readline/interface:533:10)
    at Socket.onend (node:internal/readline/interface:259:10)
    at Socket.emit (node:events:525:35)
    at endReadableNT (node:internal/streams/readable:1359:12)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
    

    the below code is used to generate the PDF in node js

    
    const jsreport = require('jsreport-core')()
    const ejsEngine = require('jsreport-ejs')
    const chromePdf = require('jsreport-chrome-pdf');
    const puppeteer = require('puppeteer');
    
    console.log('puppeteer', puppeteer.executablePath());
    
    
    
    jsreport.use(ejsEngine())
    jsreport.use(chromePdf({
      launchOptions: {
        headless: true,
        executablePath: '/usr/bin/chromium-browser',
        args: ["--no-sandbox", "--disable-setuid-sandbox", "--disable-gpu"],
        ignoreDefaultArgs: ["--disable-extensions"],
      },
    }));
    
    jsreport.init();
    
    const generateJSReport = async (details: any) => {
      console.log('report generation triggered');
      try {
        const {mainContent, headerContent, footerContent, data, marginBottom, marginTop, orientation} = details;
        const result = await jsreport.render({
          template: {
            content: mainContent,
            engine: 'ejs',
            recipe: 'chrome-pdf',
            chrome: {
              headerTemplate: headerContent,
              footerTemplate: footerContent,
              displayHeaderFooter: true,
              marginTop: marginTop,
              marginBottom: marginBottom,
              orientation: orientation,
              marginLeft: '0.8cm',
              marginRight: '0.8cm'
            }
          },
          data: {data}
        });
        return result.content;
      }
      catch (err) {
        throw err;
      }
    }
    
    export {generateJSReport};
    

    im not sure where i made the mistake could you please anyone help me to solve this issue



  • Please try to check our installation manual for your specific distribution
    https://jsreport.net/on-prem
    https://jsreport.net/learn/ubuntu
    https://jsreport.net/learn/red-hat



  • thanks for your reply the above code is working now i just assigned puppetteer.executablePath() to the launchOptions


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.