ERROR: Cannot read property 'split' of undefined (Docker N8N & Puppeteer)

Hi,

When i run the below code on my local N8N (npm installed) in function node , the code work fine and i get the status code the site, where as the same code i am executing on a N8N ( containerised) which also has puppeteer and other plugins installed, i get the error " ERROR: Cannot read property ‘split’ of undefined "

I am unable to find the reason as to why the containerised N8N is throwing this error message where as the local one works just fine. Please refer the code and error screen shot.

const puppeteer = require('puppeteer-extra');
const StealthPlugin = require('puppeteer-extra-plugin-stealth'); 
puppeteer.use(StealthPlugin());
//const puppeteer = require('puppeteer');

const browser = await puppeteer.launch({ headless: true, executablePath: '/usr/bin/chromium-browser', slowMo:10 }) //args: ['--start-fullscreen']
const page = await browser.newPage()
const data  = await page.goto('https://google.com', {
    waitUntil: 'networkidle0',
    });
var status = data.status();
return { status }
await browser.close();

Error Screenshot

Note: I know i can use a HTTP Node to get the status code, but the agenda is not to get the status code using puppeteer, its more than that. I want to try using puppeteer in a function node rather than using it on a execute node.

Hey @Sathya_Narayanan, this sounds like n8n might not have access to a fully working puppeteer setup.

Unfortunately I am not overly familiar with Puppeteer, but @marcus shared this article with me earlier describing how to set up Puppeteer inside a docker container which you might helpful: How to use Puppeteer inside a Docker container - DEV Community

You might want to check if you can build a custom image running n8n on top of this. Alternatively, you might want to check out this custom node from @drudge which should make things quite a bit simpler: