Puppeteer headless Browser in Node App


#1

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 !


#2

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:


#3

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 !


#4

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


#5

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


#6

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.


#7

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


#8

Hi @nleigh,

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


#9

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.


#10

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?


#11

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.


#12

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.


#13

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.


#14

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.


#15

How do you “disable” sandbox mode?


#16

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


#17

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


#18

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