Failure to load seemingly valid AWS S3 Signed URL

Using PDF.js Express Viewer version 8.4.1 (UI) 8.4.0 (Core)

I am having a difficult time determining why this particular signed AWS URL will not work in the Express Viewer. It just gives me a “Failed to fetch” error message. If I paste this URL in a browser tab it correctly downloads the PDF file. This is an harmless test file with a 7 day link expiration so hopefully if you can review it before it expires that’d be great. Or if there’s a ‘verbose’ debug flag or something I can flip on in the viewer to get more info that’d be great too. Thanks!

Hi Steve,

Taking a look at the error messages on my end, I suspect this to be a CORS issues with the server where this PDF is hosted.

How are you loading that PDF link into express?

What are your CORS settings on that hosted server?

Here is a guide on troubleshooting CORS support in WebViewer but should be the same process for PDF.js Express

Best Regards,
Zach Serviss
Web Development Support Engineer
PDFTron Systems, Inc.

I have successfully loaded a PDF from another S3 bucket of ours. I do see CORS errors on the HEAD but it still loads eventually. That behavior seemed to be related to this ticket 1657 (pdf-js-express-access-to-aws-s3-object-with-pre-signed-url) - can’t paste the link.

We’re using AWS Serverless so I’ll have to check on any CORS settings.

Discovered that not all of our S3 buckets have the same CORS configuration on them. Updated this particular bucket and it is working now. Thanks for the suggestion.