# Failure to load seemingly valid AWS S3 Signed URL

**URL:** <https://pdfjs.community/t/failure-to-load-seemingly-valid-aws-s3-signed-url/1805>\
**Category:** Bug Reports\
**Tags:** pdfjs-express\
**Created:** [June 22, 2022, 2:17pm UTC](https://pdfjs.community/t/failure-to-load-seemingly-valid-aws-s3-signed-url/1805 "2022-06-22T14:17:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![steve.haney](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@steve.haney](https://pdfjs.community/u/steve.haney)\
**Post date:** [June 22, 2022, 2:17pm UTC](https://pdfjs.community/t/failure-to-load-seemingly-valid-aws-s3-signed-url/1805/1 "2022-06-22T14:17:18Z")

</div>

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!

[https://portal-dev-email-attachments.s3.us-east-1.amazonaws.com/4aaa055f-dca5-42e5-ae0f-790212ebe98e?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA5PYGN7M6TGLRTOVD%2F20220622%2Fus-east-1%2Fs3%2Faws4\_request&X-Amz-Date=20220622T141306Z&X-Amz-Expires=604800&X-Amz-Signature=bb851ce1fdd33fd28e4cce96b754886470a199dad33f0a489d22c448d0e381aa&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3B%20filename%20%3D%22pdf-lib\_pdf\_page\_embedding\_example%2520%281%29.pdf%22&x-id=GetObject](https://portal-dev-email-attachments.s3.us-east-1.amazonaws.com/4aaa055f-dca5-42e5-ae0f-790212ebe98e?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA5PYGN7M6TGLRTOVD%2F20220622%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220622T141306Z&X-Amz-Expires=604800&X-Amz-Signature=bb851ce1fdd33fd28e4cce96b754886470a199dad33f0a489d22c448d0e381aa&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3B%20filename%20%3D%22pdf-lib_pdf_page_embedding_example%2520%281%29.pdf%22&x-id=GetObject)

---

<div class="post-metadata">

**Author:** ![zserviss](https://avatars.discourse-cdn.com/v4/letter/z/a9a28c/32.png) [@zserviss](https://pdfjs.community/u/zserviss)\
**Post date:** [June 22, 2022, 9:41pm UTC](https://pdfjs.community/t/failure-to-load-seemingly-valid-aws-s3-signed-url/1805/3 "2022-06-22T21:41:12Z")

</div>

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

> **[PDFTron Systems Inc. | Documentation](https://www.pdftron.com/documentation/web/faq/cors-support/)**
>
> World's #1 PDF SDK Library for Web, Mobile, Server, Desktop

Best Regards,  
Zach Serviss  
Web Development Support Engineer  
PDFTron Systems, Inc.  
[www.pdftron.com](http://www.pdftron.com/)

---

<div class="post-metadata">

**Author:** ![steve.haney](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@steve.haney](https://pdfjs.community/u/steve.haney)\
**Post date:** [June 22, 2022, 10:04pm UTC](https://pdfjs.community/t/failure-to-load-seemingly-valid-aws-s3-signed-url/1805/4 "2022-06-22T22:04:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![steve.haney](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@steve.haney](https://pdfjs.community/u/steve.haney)\
**Post date:** [June 22, 2022, 11:06pm UTC](https://pdfjs.community/t/failure-to-load-seemingly-valid-aws-s3-signed-url/1805/5 "2022-06-22T23:06:24Z")

</div>

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.
