# Uncaught TypeError: Cannot read properties of undefined (reading 'querySelector')

**URL:** <https://pdfjs.community/t/uncaught-typeerror-cannot-read-properties-of-undefined-reading-queryselector/1952>\
**Category:** Technical Support\
**Created:** [August 15, 2022, 7:40pm UTC](https://pdfjs.community/t/uncaught-typeerror-cannot-read-properties-of-undefined-reading-queryselector/1952 "2022-08-15T19:40:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rbramasco](https://avatars.discourse-cdn.com/v4/letter/r/ee7513/32.png) [@rbramasco](https://pdfjs.community/u/rbramasco)\
**Post date:** [August 15, 2022, 7:40pm UTC](https://pdfjs.community/t/uncaught-typeerror-cannot-read-properties-of-undefined-reading-queryselector/1952/1 "2022-08-15T19:40:55Z")

</div>

**Which product are you using?**

**PDF.js Express Version**

**Detailed description of issue**  
When a document loads, the viewer throws a undefined error. This also happens when the mouse moves anywhere on the page. Document loads fine, but lags to render when scrolling down or back up.  
I recently changed from @pdftron/pdfjs-express to @pdftron/pdfjs-express-viewer. I deleted all the previous files from pdfjs-express.  
I am using blazor to develop.

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/ea550283092964ddea519f0df7582520656848b4.png)

**Expected behaviour**

**Does your issue happen with every document, or just one?**  
Every document

**Link to document**

**Code snippet**  
WebViewer\_ = await WebViewer({  
path: ‘pdfjsexpress/7.8.0’,  
licenseKey: key  
}, viewerElement).then(instance =\> {

```
        window.getBlob(request_options, (blob, filename) => {
            try {
                instance.UI.loadDocument(blob, { filename: filename });
            }
            catch (e) {
                console.log(e)
            }
        })

    })

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/ffbcd25c7d423db8d5acd5db201c272f4db306dd.png) [@system](https://pdfjs.community/u/system)\
**Post date:** [August 15, 2022, 7:41pm UTC](https://pdfjs.community/t/uncaught-typeerror-cannot-read-properties-of-undefined-reading-queryselector/1952/3 "2022-08-15T19:41:01Z")

</div>

**Hello, I’m Ron, an automated tech support bot 🤖**

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:
- [Integrating PDF.js Express Plus with NPM - 2) Copy static files](https://pdfjs.express/documentation/get-started/npm#2)-copy-static-files)
- [Integrating PDF.js Express Plus with React - 3. Place WebViewer into a component](https://pdfjs.express/documentation/get-started/react#3.-place-webviewer-into-a-component)
- [Integrating PDF.js Express Viewer with NPM - 2) Copy static files](https://pdfjs.express/documentation/get-started-viewer/npm#2)-copy-static-files)

APIs:
- [PDF.js Express Utilities](https://pdfjs.express/api/utils/index.html#__anchor)
- [UndefinedbeforeDocumentLoaded](https://pdfjs.express/api/namespaces.list.html#event:beforeDocumentLoaded__anchor)
- [ExpressUtils(optionsopt) - # async extract() → {Promise.}](https://pdfjs.express/api/utils/ExpressUtils.html#extract__anchor)

Forums:
- [Am getting this error when loading WebViewer with Vue application](https://pdfjs.community/t/am-getting-this-error-when-loading-webviewer-with-vue-application/1319/1)
- [PDF.js Express Viewer Watermarks](https://pdfjs.community/t/pdf-js-express-viewer-watermarks/1614/1)
- [Parts of PDF text are not displayed - like whiteout has been wiped across](https://pdfjs.community/t/parts-of-pdf-text-are-not-displayed-like-whiteout-has-been-wiped-across/1895/1)

---

<div class="post-metadata">

**Author:** ![rbramasco](https://avatars.discourse-cdn.com/v4/letter/r/ee7513/32.png) [@rbramasco](https://pdfjs.community/u/rbramasco)\
**Post date:** [August 15, 2022, 8:05pm UTC](https://pdfjs.community/t/uncaught-typeerror-cannot-read-properties-of-undefined-reading-queryselector/1952/4 "2022-08-15T20:05:17Z")

</div>

Found temp solution: [PDF Viewer React sample has error - #3 by dfelix](https://pdfjs.community/t/pdf-viewer-react-sample-has-error/1927/3)

---

<div class="post-metadata">

**Author:** ![tgordon](https://avatars.discourse-cdn.com/v4/letter/t/aca169/32.png) [@tgordon](https://pdfjs.community/u/tgordon)\
**Post date:** [August 16, 2022, 6:08pm UTC](https://pdfjs.community/t/uncaught-typeerror-cannot-read-properties-of-undefined-reading-queryselector/1952/5 "2022-08-16T18:08:16Z")

</div>

Hello rbramasco,

The fix will be fixed in our next version which should be this month. Thank you for your patience!

Best regards,  
Tyler Gordon  
Web Development Support Engineer  
PDFTron

Share how you are using PDF.js Express in your organization you could win a **$500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free**. Learn more [here](https://utm.guru/ueQNw)

---

<div class="post-metadata">

**Author:** ![rbramasco](https://avatars.discourse-cdn.com/v4/letter/r/ee7513/32.png) [@rbramasco](https://pdfjs.community/u/rbramasco)\
**Post date:** [October 7, 2022, 11:51pm UTC](https://pdfjs.community/t/uncaught-typeerror-cannot-read-properties-of-undefined-reading-queryselector/1952/6 "2022-10-07T23:51:37Z")

</div>

Is there any news on this error? I tested this on 8.4 as well, same issue

---

<div class="post-metadata">

**Author:** ![tgordon](https://avatars.discourse-cdn.com/v4/letter/t/aca169/32.png) [@tgordon](https://pdfjs.community/u/tgordon)\
**Post date:** [October 11, 2022, 6:19pm UTC](https://pdfjs.community/t/uncaught-typeerror-cannot-read-properties-of-undefined-reading-queryselector/1952/7 "2022-10-11T18:19:59Z")

</div>

Hello rbramasco,

I was unable to reproduce this error on our latest version.

Best regards,  
Tyler Gordon  
Web Development Support Engineer  
PDFTron

Share how you are using PDF.js Express in your organization you could win a **$500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free**. Learn more [here](https://utm.guru/ueQNw)
