# The promise from WebViewer function is rejected

**URL:** <https://pdfjs.community/t/the-promise-from-webviewer-function-is-rejected/1308>\
**Category:** Technical Support\
**Created:** [January 19, 2022, 7:48am UTC](https://pdfjs.community/t/the-promise-from-webviewer-function-is-rejected/1308 "2022-01-19T07:48:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![user59](https://avatars.discourse-cdn.com/v4/letter/u/74df32/32.png) [@user59](https://pdfjs.community/u/user59)\
**Post date:** [January 19, 2022, 7:48am UTC](https://pdfjs.community/t/the-promise-from-webviewer-function-is-rejected/1308/1 "2022-01-19T07:48:41Z")

</div>

**Which product are you using?**  
PDF.js Express Viewer

**PDF.js Express Version**

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

**Detailed description of issue**  
@Logan,Hi Mr. Logan, I saw the demo case and it was great.But I ran into some problems when I tried. I registered lisenceKey, and it shows that lisenceKey binding is correct in offline test. However, under this domain name, an error occurred. I changed the cORS Settings for the document server, but it still didn’t work. My config.js doesn’t work either.

**Expected behaviour**  
{Provide a screenshot or description of the expected behaviour}

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

**Link to document**  
{Provide a link to the document in question if possible}

**Code snippet**  
{Provide a relevant code snippet}  
 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/17884884ccc6367fdac6814b40b44aaecfcb9af9.png)

```javascript
 useEffect(() => {
    if (ereportInfo) {
      WebViewer(
        {
          path: `${process.env.REACT_APP_Path}/lib/webviewer`,
          licenseKey: 'xxxxxx',
          initialDoc: ereportInfo.link_path,
          config: `${process.env.REACT_APP_Path}/config.js`
        },
        viewer.current
      )
    }
  }, [ereportInfo])

```

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

```javascript
instance.UI.addEventListener(instance.UI.Events.VIEWER_LOADED, () => {
  instance.setFitMode(instance.FitMode.FitWidth)
})

```

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

localhost:

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

online:

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

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/50c5f832922b1ff0d54add8dd6a70ab04b07aef1.png)  
 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/54c8d87ab8974245274e7454e9f896ea3fa432f6.png)  
 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/dae665a2c5ae736224d71c559a3873309486fe21.png)  
 ![image](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/7a8b8fc45c7896a9591b54eec0970de29ede7b9b.png)

Anything I am potentially missing?

---

<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:** [January 19, 2022, 7:48am UTC](https://pdfjs.community/t/the-promise-from-webviewer-function-is-rejected/1308/3 "2022-01-19T07:48:46Z")

</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:
- [Adding your license key](https://pdfjs.express/documentation/get-started-viewer/add-license-key)
- [Integrating PDF.js Express Viewer into a new Angular project - Sample overview - Assets and scripts](https://pdfjs.express/documentation/get-started-viewer/angular/new-project#assets-and-scripts)
- [Angular project WebViewer integration issues](https://pdfjs.express/documentation/get-started-viewer/angular/angular-integration-issues)

APIs:
- [Core - setLocalWorkerPath(workerPath, isExact)](https://pdfjs.express/api/Core.html#.setLocalWorkerPath__anchor)
- [UI.VerificationOptions](https://pdfjs.express/api/UI.VerificationOptions.html#__anchor)
- [UndefinedWebViewer(options, viewerElement)](https://pdfjs.express/api/global.html#WebViewer__anchor)

Forums:
- [‘instance’ is not defined](https://pdfjs.community/t/instance-is-not-defined/1302/1)
- [Webviewer initialization error](https://pdfjs.community/t/webviewer-initialization-error/173/1)
- [How to use PDF.js Express Viewer in Electron](https://pdfjs.community/t/how-to-use-pdf-js-express-viewer-in-electron/1122/1)

---

<div class="post-metadata">

**Author:** ![Logan](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/logan/32/13_2.png) [@Logan](https://pdfjs.community/u/Logan)\
**Post date:** [January 20, 2022, 3:21pm UTC](https://pdfjs.community/t/the-promise-from-webviewer-function-is-rejected/1308/4 "2022-01-20T15:21:20Z")

</div>

Hey there!

Can you try updating to the latest version and letting me know if it fixes it? We had some timing issues in 8.1 that may be the issue here.

Let me know,

Thanks,  
Logan

---

<div class="post-metadata">

**Author:** ![user59](https://avatars.discourse-cdn.com/v4/letter/u/74df32/32.png) [@user59](https://pdfjs.community/u/user59)\
**Post date:** [January 21, 2022, 8:17am UTC](https://pdfjs.community/t/the-promise-from-webviewer-function-is-rejected/1308/5 "2022-01-21T08:17:26Z")

</div>

After I updated the version to 8.2, the problem was solved , Thanks a million! 👍

---

<div class="post-metadata">

**Author:** ![Logan](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/logan/32/13_2.png) [@Logan](https://pdfjs.community/u/Logan)\
**Post date:** [January 24, 2022, 6:35pm UTC](https://pdfjs.community/t/the-promise-from-webviewer-function-is-rejected/1308/6 "2022-01-24T18:35:35Z")

</div>


