Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] pdfjs-dist loader issue [Update version] #87

Open
prafulrajhm opened this issue Nov 22, 2021 · 11 comments
Open

[BUG] pdfjs-dist loader issue [Update version] #87

prafulrajhm opened this issue Nov 22, 2021 · 11 comments
Assignees
Labels
bug Something isn't working

Comments

@prafulrajhm
Copy link

When I update the package to the latest version, I am getting the below error

Code_7bkZS7zwvW

How to Reproduce
Steps to reproduce the behavior:

  1. Check next js app with all latest versions (Mentioned below)

Expected behavior
Should work!

Details (please complete the following information):

  • Device: Desktop
  • OS: Windows 10
  • Browser: chrome(96.0.4664.45)
  • Version: 2.2.3 , React: 16.14.0

Additional context
mozilla/pdf.js#13200

@prafulrajhm prafulrajhm added the bug Something isn't working label Nov 22, 2021
@Luiscastor
Copy link

hello, i'm having the same problem. did you find a solution for this?

@prafulrajhm
Copy link
Author

hello, i'm having the same problem. did you find a solution for this?

No, I used 2.1.2 only which requires 2.5.207 version of pdfjs-dist.

@Luiscastor
Copy link

Okey error is gone but now i got this one Error while reading the pages ! :(

@prafulrajhm
Copy link
Author

Okey error is gone but now i got this one Error while reading the pages ! :(

It can be of number of reasons! check the console.

May be pdf file is wrong or the way you are passing the props.

@Luiscastor
Copy link

All good, thank u so much bro! I'm gonna be working with this problem jeje xd

@mepritam
Copy link

mepritam commented Dec 2, 2021

I had the same issue. Just downgrade pdfjs-dist to 2.6.347.
Run npm install [email protected]

@Luiscastor
Copy link

Hello sr, I do not know what it's happening. I downgrade pdfjs-dist to 2.6.347. but I'm getting the first error,
the one that you post.

@mepritam
Copy link

mepritam commented Dec 3, 2021

Okey error is gone but now i got this one Error while reading the pages ! :(

Which one ?

@Luiscastor
Copy link

Captura de Pantalla 2021-12-03 a la(s) 21 45 40

this one bro.

@swingtechnologies
Copy link

The below solution works for me
First, install
npm install npm-force-resolutions --save-dev

Then in package.json we need to override the pdfjs-dist version to previous working version like this

"dependencies": {
   "pdf-viewer-reactjs": "2.2.3",
}.
"scripts": {
   "preinstall": "npx npm-force-resolutions"
},
"resolutions": {
    "pdfjs-dist": "2.6.347"
 }

and in scripts section add new preinstall entry:

"preinstall": "npx npm-force-resolutions",
now if you do npm install and run your application it should work. Hope it helps

The root cause of the problem is , though in the dependency package.json has version 2.6.347 for pdfjs-dist since ^ was there before the version number during npm install, it installs the most recent version of pdfjs-dist which is causing this problem.

@WalissonRodrigo
Copy link

I'm found this problem and solve using useMemo to generate object url. This commet has details and an example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants