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:

hello @drudge , thank you for creating puppteer to n8n through community nodes, however, may i know how to include chrome to n8n docker setup ?
I am having problem as chrome is missing from my n8n docker setup. ( as shown below )

Hi @Benjamin123!

@marcus created a Github repo to show how to get this working in a Docker setup with n8n:

Im also having a similar issue using Docker Compose. Not quite sure how to do about it.

Hey @pford,

What issue are you having and what does your compose file look like (don’t forget to remove anything sensitive).

Im running into this same issue with another external module actually and I think it requires a custom Dockerfile, but even after creating a replacing n8n Docker image using a new Dockerfile I still get this same issue.

Hey @pford,

Can you share more? It is hard to know what needs to be done without seeing what you are tying and what the error is.