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

PDF not loading on Netlify but is OK on localhost #44

Open
GerBreOwn opened this issue Aug 4, 2023 · 8 comments
Open

PDF not loading on Netlify but is OK on localhost #44

GerBreOwn opened this issue Aug 4, 2023 · 8 comments

Comments

@GerBreOwn
Copy link

Describe the bug
A clear and concise description of what the bug is.
When I upload my site to Netlify the spinner keeps on spinning but at the localhost it loads in a very short time.

To Reproduce
Steps to reproduce the behavior:
Open page with the "hugo-embed-pdf-shortcode"

Expected behavior
A clear and concise description of what you expected to happen.
I expect to see the PDF file

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Ubuntu 23.04
  • Browser [e.g. chrome, safari]
  • Brave browser, Firefox, Chrome
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.
I had installed it and the problem started where it was not loading on Netlify and had stopped loading on localhost. I then reinstalled it and it started reloading in localhost but not on Netlify.
I think I have read of other people having this problem with Netlify but I didn't see any solutions to the problem.

@anvithks
Copy link
Owner

anvithks commented Aug 4, 2023

Hi @GerBreOwn . Could you please share a link to your repository and the file where you are trying to embed the pdf.

@GerBreOwn
Copy link
Author

gerbreown/epghoa is my github repository. The file is /content/Minutes/feb-26-minutes. When I look at your file "pdf.worker.js" I do not find any lines with "GlobalWorkerOptions" in them especially at line 124 like your instructions state.
Thanks.

@anvithks
Copy link
Owner

gerbreown/epghoa is my github repository. The file is /content/Minutes/feb-26-minutes. When I look at your file "pdf.worker.js" I do not find any lines with "GlobalWorkerOptions" in them especially at line 124 like your instructions state. Thanks.

Let me take a look and get back to you.

@anvithks
Copy link
Owner

@GerBreOwn I am unable to find this repository https://github.com/gerbreown/epghoa.
Is it a private repo by any chance?

@rachelroods
Copy link

I am also seeing this issue, things work fine locally but I am getting a 404 https://<SomeURL>.github.io/js/pdf-js/build/pdf.js when trying to access pdf.js. I installed hugo-embed-pdf-shortcode via the git submodule commands. I am using Github pages if that isn't clear. Are there any trouble shooting actions that are suggested? Thanks!

@eviscerat
Copy link

eviscerat commented Jan 17, 2024

Hi I m seeing the same issue, it works on localhost, it does not work on live. I host my website in aws s3. I can download the pdf file, it just keeps loading without showing.
In console I get the errors:


 Failed to load resource: net::ERR_NAME_NOT_RESOLVED                                                                  pdf.worker.js:1 
 Uncaught (in promise) Error: Setting up fake worker failed: "Cannot load script at: https://<website-domain>js/pdf-js/build/pdf.worker.js".                                                                                                                                     at api.js:2219:11

@eviscerat
Copy link

eviscerat commented Jan 18, 2024

Hi I m seeing the same issue, it works on localhost, it does not work on live. I host my website in aws s3. I can download the pdf file, it just keeps loading without showing. In console I get the errors:


 Failed to load resource: net::ERR_NAME_NOT_RESOLVED                                                                  pdf.worker.js:1 
 Uncaught (in promise) Error: Setting up fake worker failed: "Cannot load script at: https://<website-domain>js/pdf-js/build/pdf.worker.js".                                                                                                                                     at api.js:2219:11

I fixed my issue it was a very simple missing "/" in worker source url. It seems it is unrelated to OP's issue:

pdfjsLib.GlobalWorkerOptions.workerSrc = "{{.Site.BaseURL}}" + 'js/pdf-js/build/pdf.worker.js';

chnged to this:

pdfjsLib.GlobalWorkerOptions.workerSrc = "{{.Site.BaseURL}}" + '/js/pdf-js/build/pdf.worker.js';

@shengdong00
Copy link

Hi I m seeing the same issue, it works on localhost, it does not work on live. I host my website in aws s3. I can download the pdf file, it just keeps loading without showing. In console I get the errors:


 Failed to load resource: net::ERR_NAME_NOT_RESOLVED                                                                  pdf.worker.js:1 
 Uncaught (in promise) Error: Setting up fake worker failed: "Cannot load script at: https://<website-domain>js/pdf-js/build/pdf.worker.js".                                                                                                                                     at api.js:2219:11

I fixed my issue it was a very simple missing "/" in worker source url. It seems it is unrelated to OP's issue:

pdfjsLib.GlobalWorkerOptions.workerSrc = "{{.Site.BaseURL}}" + 'js/pdf-js/build/pdf.worker.js';

chnged to this:

pdfjsLib.GlobalWorkerOptions.workerSrc = "{{.Site.BaseURL}}" + '/js/pdf-js/build/pdf.worker.js';

Same issue here and successfully fixed according to your method. thx

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

No branches or pull requests

5 participants