R
Railway•14mo ago
Castle

Puppeteer package update

I can run a command without this package, but need it for the host to opperate. They deprecated my packaged and it broke my command, I updated it and it's still not working. I'm not getting any errors, however my command just isn't working when hosted. const outputFilePath = await convertFile(inputFilePath, { puppeteer: { headless: 'new', args: ['--no-sandbox', '--disable-setuid-sandbox'] }, }); A rundown of the command, converts an SVG to a png. Uses the npm package "convert-svg-to-png". Everything still works locally, it's just when hosted the commands that use this code break. Not sure if anyone has any tips on where to start cause I've done 35 commits tonight and can't get it.
21 Replies
Percy
Percy•14mo ago
Project ID: 16ae5c85-ef95-4976-b025-d0f2b7ddfca3
Castle
CastleOP•14mo ago
16ae5c85-ef95-4976-b025-d0f2b7ddfca3
Brody
Brody•14mo ago
and theres no errors at all, anywhere?
Castle
CastleOP•14mo ago
Nope The image just isn't being generated. Locally it is tho
Brody
Brody•14mo ago
then theres not much to go off of, do you have error handling and logging in place already?
Castle
CastleOP•14mo ago
I do have a logger for errors but nothing pops of for this. No type or api errors Trying something, will keep you posted threw it in a try catch to log errors. Not sure why I waited this long to do this
Brody
Brody•14mo ago
sounds good, but yeah without errors theres not all that much we can do to help
Castle
CastleOP•14mo ago
Was getting different errors up until this point, now I'm out of them lmao
Brody
Brody•14mo ago
keep me posted
Castle
CastleOP•14mo ago
threw rhe try catch around the wrong block 😭 its too late to be dealing with problems <:Laughing_Clown:852881915140243497>
Brody
Brody•14mo ago
honestly id look into a way to convert svg to png without using chrome i dont think you need me to tell you this, but that is a very fragile system
Castle
CastleOP•14mo ago
I threw the try catch to the "interaction.editReply({" block and got no errors. I can't have it above or it just disables it.
No description
Brody
Brody•14mo ago
please consider this
Castle
CastleOP•14mo ago
I'll look into it more tomorrow
Brody
Brody•14mo ago
looks like sharp can do it https://github.com/lovell/sharp
Castle
CastleOP•14mo ago
let me try that rq
Brody
Brody•14mo ago
youll need this then, add this to a nixpacks.toml file in your project
[phases.setup]
aptPkgs = ['...', 'libvips-dev']
[phases.setup]
aptPkgs = ['...', 'libvips-dev']
0xdima95
0xdima95•14mo ago
Hijacking this thread, I also cannot run puppeteer. get this error and have the same set up as OP. [0930/162038.763649:ERROR:zygote_host_impl_linux.cc(100)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
Brody
Brody•14mo ago
while the original poster may have gotten errors, this part of their code was correct
puppeteer: {
headless: 'new',
args: ['--no-sandbox', '--disable-setuid-sandbox']
},
puppeteer: {
headless: 'new',
args: ['--no-sandbox', '--disable-setuid-sandbox']
},
though the syntax when using puppeteer directly (and not through another wrapper) will be a little different
0xdima95
0xdima95•14mo ago
And as soon as I typed this, it works now I didn't compile my ts to js before pushing. Is there a way to get railway run tsc on my .ts files?
Brody
Brody•14mo ago
add a build script to your package.json that runs the applicable tsc command to compile your ts, then your start script should be set up to run your compiled js
Want results from more Discord servers?
Add your server