WebViewer not loading on Gatsby + Netlify deploy

WebViewer Version: "^7.3.2"

Do you have an issue with a specific file(s)? no.
Can you reproduce using one of our samples or online demos? yes for the sample, no for the online demo.
Are you using the WebViewer server? no.
Does the issue only happen on certain browsers? no, on all browsers.
Is your issue related to a front-end framework? yes, GatsbyJS v3.6.1
Is your issue related to annotations? no.

Please give a brief summary of your issue:
The Webviewer works on our local development environment but don’t if we deploy it to Netlify.
We have follow the whole trial tutorial for npm and copy the public folder of node_module/@pdftron/webviewer/public/ into the static folder of Gatsby (which is copied into the public folder of the client app) and we renamed it to webviewer.
The Webviewer seems to be locked into an infinite loop because we don’t have any errors and nothing happen.

This is the sample code which works in local:

useEffect(() => {
    if (data)
      import("@pdftron/webviewer").then(WebViewerModule => {
        let WebViewer = WebViewerModule.default
          path: "webviewer",
        }, viewerDiv.current)
          .then(instance => {
            // `myBlob` is your blob data which can come
            // from sources such as a server or the filesystem
            instance.loadDocument(data, {
              filename: document.filename,
              extension: document.content_type.substr(1).toUpperCase(),
            const { docViewer } = instance
            docViewer.on("documentLoaded", () => {
              // perform document operations
          }).catch(err => {
            console.log("ERR ON WEBVIEWER", err)
      }).catch(err => { console.log("err on import", err) })
  }, [data, document.filename, document.content_type])

Best Regards,
Remy Oster, Luca Hermann.
Zenlaw, inc.

Hello, I’m Ron, an automated tech support bot :robot:

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


First, I suggest you go to the browser network tab and check if there are any files that are not loaded (for example, 404 in response code).

Other than that, in order for us to investigate further, can you provide the following?

  1. Is your application open to the public? If so, please provide the URL and also the conditionals if needed
  2. Can you provide your entire code? (If possible, push them to a git repo) and let me know the steps to set it up. I am asking this because normally it can be a lot easier if we can reproduce the same issue on our side.