Puppeteer headless Browser in Node App

Hello,
I know glitch does not have enough space to install the chromium browser via the terminal when installing puppeteer. But is there maybe a possibility to get the chromium in the assets because there would be enough space. I really love glitch and dont want to change because i cant let my discord bot live to his full potential !

thanks for your answers !

1 Like

Hi @stoesselleon,

we are implementing an alternative way to install dependencies that allows the installation of very large packages, such as puppeteer. I’ll let you know when we deploy it, so that we can also get feedback on how it works for your use case :slight_smile:

1 Like

hi ! i´m glad to hear that ! can you give me some sort of “goal” when it gets deployed ? :slight_smile:
as my bot needs to get online again i would have to switch in the meantime :confused:
but i will comeback of course and i would even pay for that kind of service !

EDIT: sorry, I didn’t understand your previous post. I think we’ll deploy it next week.

3 Likes

Hi, Was this ever implemented? I’d like to try Puppeteer on a project.

Yes, if you create a new project you should be able to install puppeteer without issue. You’ll have to run it in no sandbox mode though to get it to start.

1 Like

Has the root cause of Puppeteer not working with the sandbox on Glitch been determined?

Hi @noelleleigh,

yes: glitch projects run inside docker containers, which can’t run the sandbox.

1 Like

Depending on your use cases, I found http://phantomjs.org to be a lightweight alternative to puppeteer finding similar functionality while only excluding the more complex functionality puppeteer provides.

Hi,

I had puppeteer running in a project without issue for the last few months, and now suddenly I’m getting npm WARN tar ENOSPC: no space left on device, write issues. I’ve tried pruning npm and git, removing files, and changing to an older chromium version, but nothing seems to work. Did something change recently?

No, nothing changed as far as I’m aware. But it’d be useful to make sure you’re using pnpm rather than npm, as that’s the only way Puppeteer can fit on a glitch instance. Run enable-pnpm from the command line.

Hmm, I ran enable-pnpm and reinstalled all modules, but I’m getting

ERROR: Failed to download Chromium r555668! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download.

{ Error: ENOSPC: no space left on device, write errno: -28, code: 'ENOSPC', syscall: 'write' }

What’s odd is that the app started failing this morning when it’s been running without any changes up to then for the last few weeks.

Ah ok, if you can DM me a join link (from the share menu in the editor) for your project then I can take a look and see if we can figure out what’s up.

1 Like

I sent you the join link, but in the meantime I just started a blank project and installed the same modules and am seeing the same chromium download error.

How do you “disable” sandbox mode?

Add the --no-sandbox argument, see https://glitch.com/edit/#!/puppeteer-sample for an example

thanks @aksm - there was an issue on our side. Fixed now! Sorry for the hassle.

1 Like

For some reason running enable-pnpm didn’t do the right thing for me.

I looked at the node_modules in the puppeteer-sample you shared and recreated it like so:

cd /app; rm -rf node_modules/* node_modules/.* 2> /dev/null; rm -rf node_modules; ln -s /rbd/pnpm-volume/app/node_modules /app/node_modules; refresh

Then used the --no-sandbox option when launching puppeteer and all is good.

Thanks @Gareth