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

BindingError #2892

Open
jonnny013 opened this issue Sep 30, 2024 · 9 comments · May be fixed by #2878
Open

BindingError #2892

jonnny013 opened this issue Sep 30, 2024 · 9 comments · May be fixed by #2878

Comments

@jonnny013
Copy link

I recently ran the latest update (4.0.0) and everything works fine, but I get the annoying bug in the console for a binding error:
"Expected null or instance of Config, got an instance of Config"
Stack trace[0]
Error. (http://localhost:3000/node_modules/.vite/deps/@react-pdf_renderer.js?v=5fc542da:85453:13)

It doesn't seem to be causing any issues, I just like to keep the console clean and I don't have a clue what the issue is.

I am happy to add on more information, but I don't know what information would be helpful for this.

@jstorm31
Copy link

jstorm31 commented Sep 30, 2024

I started getting this error too with @react-pdf/[email protected].

Edit: upgrading to version 4.0.0 didn't help.

Edit 2:
I was rendering multiple PDFs with Promise.all. Generating them sequentially in for...of loop helped.

HuguesBlanco added a commit to HuguesBlanco/get-cv that referenced this issue Sep 30, 2024
Encountered errors while importing assets (primarily fonts), causing console errors and production build failures. The issue stemmed from asset names being hashed in production, breaking manual URL construction. Resolved by using Vite's `import` to retrieve asset URLs, which correctly handles the hashed filenames.

Additionally, moved the `asset` folder into the `cv` directory to finalize the decoupling of the CV section from the rest of the application.

One console error remains: BindingError: "Expected null or instance of Config, got an instance of Config." This seems to cause the CV PDF to occasionally not load upon refresh, though the exact cause is unclear. An issue request is open for further investigation: diegomura/react-pdf#2892
@pontageorge
Copy link

pontageorge commented Oct 1, 2024

I get this error and the PDViewer actually fails to render my PDF ocassionally and I have no idea why.

@HuguesBlanco
Copy link

HuguesBlanco commented Oct 1, 2024

I’m encountering the same issue

  • @react-pdf/renderer: 3.4.4
  • vite: 5.4.8
  • Chrome: 129.0.6668.70

I use a <Document> component in both a <PDFViewer> and a <PDFDownloadLink>, and it seems that rendering them simultaneously might be causing the error.

If I remove one, the error goes away.
Rendering them sequentially, as @jstorm31 suggested, also fixes it. (I tested this using a setTimeout).

Are you all also using multiple <Document> components?

@pontageorge
Copy link

I was the same way as you with a <PDFViewer> and a <PDFDownloadLink>. Now I just have the PDFViewer, still encountering the issue unfortunately. Also, update to the PDF state don't trigger a rerender of the PDFViewer, not sure if it's related or not or it wasn't supposed to do that anyways.

@FastRives
Copy link

FastRives commented Oct 1, 2024

Hello everyone,

I encountered the same issue and resolved it by redefining the <img /> component. The previous version no longer accepted a src with a URL, so to fix the problem, I converted my image into a Base64 string, and now it works good.

I'm not sure if you're facing the same issue, but this approach might be worth exploring.

Best regards,
FastRives.

@HuguesBlanco
Copy link

Hi everyone,

After further investigation, I came across this pull request, which provides more insight into the issue: #2878.
It appears that the problem is related to Yoga's initialization. A fix has been submitted and is currently awaiting merge.

@luokelong
Copy link

luokelong commented Oct 3, 2024

Hi everyone,

After further investigation, I came across this pull request, which provides more insight into the issue: #2878. It appears that the problem is related to Yoga's initialization. A fix has been submitted and is currently awaiting merge.

I encountered the same problem. But the difference with you is that the problem mentioned in #2890 also occurred at all the time, and this BindingError occurred only some time. I'm guessing there's some connection between these two issues.

Without a doubt, you are the best.

@JohnFoster44
Copy link

I'm getting this error on Firefox just using the PDFDownloadLink. Stopping the PDF from being downloaded unless I refresh.

@HuguesBlanco
Copy link

Hi everyone,
After further investigation, I came across this pull request, which provides more insight into the issue: #2878. It appears that the problem is related to Yoga's initialization. A fix has been submitted and is currently awaiting merge.

I encountered the same problem. But the difference with you is that the problem mentioned in #2890 also occurred at all the time, and this BindingError occurred only some time. I'm guessing there's some connection between these two issues.

Without a doubt, you are the best.

@luokelong, I haven’t encountered the second error you mentioned.
Regarding the first issue, I agree that it varies. Sometimes it happens once, other times twice. I suspect this variation is due to how long my machine takes to load and render the documents, which might affect the error trigger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants