-
-
Notifications
You must be signed in to change notification settings - Fork 916
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
Intermitted failure to load PDF #1753
Comments
I am seeing similar issue, however I am not able to capture logs the author provided. Behaviour I see: file is rendered correctly within CRA app. Once page is left for a few minutes, or sometimes there are a few interactions with the page not related to PDF, PDF becomes blank. It reappears if user forces rerender by changing pdf block size, which we allow. On page refresh pdf is again present as well and will again become blank after certain time |
@quarryman Your issue is likely #1798, not that. |
@Jimbob001 your workerSrc implementation looks fine. I'd check if you have multiple versions of
|
HI @wojtekmaj, no is the short answer. I haven't got I've just sent a donation as a thank you for your work on this library, any further help / suggestions on the above would be appreciated. |
I had this same issue. I had to run |
@codydaig literally Either way... don't think it's working for me... :/ Can you explain the dependabot alert and change? Haven't heard of it and might be something I can look into. |
@Jimbob001 Not sure about yarn. I'm not using yarn for this project, just npm. After the last few days, I haven't seen an error come through in over 100,000 pdf loads. Here's the link to the dependabot security advisory. It bumped the react-pdf version from 6 to 7 for me and that's where all my issues started. GHSA-87hq-q4gp-9wr4 |
@codydaig OK, so you've installed v3.0.0 I think, which is different from what's mean to be used by this library... odd. I've added If that doesn't work, I guess I'll upgrade to V9 and see where that takes me... |
@Jimbob001 Good luck. To clarify one piece, I've installed version |
i am currently facing similar challenge, trying to load pdf's using the reactpdf and the pdfjs-dist version 2.16.105. |
if this hasnt been solved yet i have a solution, some pdfs are loading and some arent loading because of the naming of the pdfs. try this - take out the spaces you find in the names of the pdf and itl'l work perfectly well. |
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 14 days. |
this worked however drop the |
Before you start - checklist
Description
I'm using a create-react-app setup, and I'm seeing an intermittent issue whereby the PDF fails to load some of the time, usually after loading a PDF a while after initial refresh of the app. I've trawled issues across many sites and tried all sorts, but just can't work out what is going wrong nor a solution.
Please see the additional information, tried to explain as much as I can but it's hazy in places give the nature of the issue. Would be amazed if it's just me seeing this issue but please, put me out of my misery either way!
Steps to reproduce
Expected behavior
PDF should load every time
Actual behavior
PDF sometimes fails to load
Additional information
Since I'm using CRA, I'm using the CDN load technique as it's recommended. I've also tried many other implementations out of hope but they didn't work at all etc. I've tried an external CDN to cross check, but have an automated build to host the worker ourselves. So it looks something like this:
On initial page refresh and first load of the PDF, everything loads correctly. Multiple opens, new PDFs etc and everything is fine. However, the PDF fails to load some time after refresh, I use Sentry to capture the events but also have seen it with my own eyes. It doesn't have to be a long time, can only vaguely say "a lot of content change" after refresh seems to cause it, but I haven't been able to find anything concrete.
Via the production error logging, I can see this same issue across all browsers etc, also had this across a range of our own use cases. Obviously tried emptying browser caches etc, from the range of devices and the time we've had this issue, can't imagine that's the problem.
The error logged is
"The API version "3.11.174" does not match the Worker version "2.16.105"
. 2.16.105 is last version of pdfjs we used before upgrading a while ago, for interest sake. As I said, I've tried loading directly from a CDN, as well as checking the version in our self served file; it's just not the wrong version! We also get theSetting up fake worker
console log, I'm not sure if the above is because this fake worker of the wrong version?Another possible explainer is there is no attempt to load the PDF file before this error happens. That would imply the library is failing to load before attempting to load actual content.
Even given this a go, pre-downloading the worker file before loading the React component, still no luck:
Environment
The text was updated successfully, but these errors were encountered: