You are not logged in.

#1 2022-06-02 13:44:42

Eurkz
Member
Registered: 2021-07-21
Posts: 49

Arch not opening certain PDFs in web browsers

I'm a software developer so I'm working in a Next.js API route

I'm trying to open  PDF files in Firefox (just pictures of different product labels), and when I click on the link I get a new tab showing error on the page saying "res.buffer() is not a function".  This also happens in Chrome, and yes my packages are up to date. Me and my coworker couldn't figure out why this was happening so I decided to boot into windows, re-clone the repository, and run the app. To my surprise it started working for every product label.

I can open other PDFs in the browser on arch just fine so I'm not sure why this is happening. Am I missing a node package that would fix this?

I'm just really confused why the browsers in Arch wont load these pdfs, but running the same code on windows it works no problem.

Any ideas of whats going on here?

Offline

#2 2022-06-02 13:47:00

rafaellancas
Member
Registered: 2022-05-31
Posts: 86

Re: Arch not opening certain PDFs in web browsers

Well, you do know that Chrome for linux is something and Chrome for windows is a completely different thing right? Have you tried using other browsers like Opera?

Offline

#3 2022-06-02 14:40:36

Eurkz
Member
Registered: 2021-07-21
Posts: 49

Re: Arch not opening certain PDFs in web browsers

Still getting a {"error":"res.buffer is not a function"} in the opera browser.

Offline

#4 2022-06-03 06:08:47

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,582

Re: Arch not opening certain PDFs in web browsers

That's not the browser or the OS but whatever version of goddamnfuckingnodejsshit you're using.
Use arrayBuffer, https://github.com/perry-mitchell/webda … -368195381 or https://stackoverflow.com/a/66183520

Offline

#5 2022-06-06 16:55:39

Eurkz
Member
Registered: 2021-07-21
Posts: 49

Re: Arch not opening certain PDFs in web browsers

I'm running node version 18.3.0 on arch.
I also tried the arrayBuffer() method but that didn't work either. I'm going to try downgrading node to see if that helps.

Offline

#6 2022-06-06 17:11:40

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,480
Website

Re: Arch not opening certain PDFs in web browsers

Eurkz wrote:

I also tried the arrayBuffer() method but that didn't work either.

Exactly how did you try it (where's the code)?  And how did it not work (what error did it produce)?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#7 2022-06-06 17:17:20

Eurkz
Member
Registered: 2021-07-21
Posts: 49

Re: Arch not opening certain PDFs in web browsers

Downgraded to node 16.15.1, problem fixed itself without having to change any code.

Offline

#8 2022-06-06 17:22:52

progandy
Member
Registered: 2012-05-17
Posts: 5,319

Re: Arch not opening certain PDFs in web browsers

Eurkz wrote:

Downgraded to node 16.15.1, problem fixed itself without having to change any code.

Don't forget about that problem, though. You'll have to address it in the next 2 years when node 16 support ends and you have to move to node 18 or 20.


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#9 2022-06-06 18:15:17

Eurkz
Member
Registered: 2021-07-21
Posts: 49

Re: Arch not opening certain PDFs in web browsers

Noted

Offline

Board footer

Powered by FluxBB