License key is not recognized in production

PDF.js Express Version

Detailed description of issue


in production, when I load a file with the PDF Express Viewer, I have this error message
"A valid license key is required to use the view only build of PDF.js "

However, I did create a license key and used it as an option parameter. It even perfectly works in localhost :
From my account, I have created 2 keys :

  • one for the “localhost:3000” domain : it works.
  • one for the domain : I have the error.

I’m using a React app and used .env to set the 2 keys for the 2 different envs. I can’t figure out what’s going wrong…

Expected behaviour

the document should load in production, similarly to what is happening in localhost.

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

Code snippet
Here how the WebViewer is configured.

        path: "../../../pdftron/public",
        licenseKey: process.env.REACT_APP_PDFTRON_EXPRESS_KEY,
        initialDoc: url,

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:


Hey there!

I checked out and tested your license key and did not find any issues. Can you confirm that process.env.REACT_APP_PDFTRON_EXPRESS_KEY is being set correctly? You should see a request to in the network tab - can you send me a screenshot of that via DM?


Hi @Logan , thanks for you quick answer. I have a successful request to with the key used in production env.


More info about the issue :
I’m loading the document from a dataURL. It’s working find in localhost even if I have the following error message in the console.

I serving my app on and the key is registered for the main domain. Would that explain the error ?

Hi @Logan , by the way, where should I go to write to you via DM ?

Hey there,

You can DM me right here in the forum.

The subdomain shouldn’t be an issue. If you could DM me that screenshot but with no redactions, that would be great. Thanks!


Hi @Logan , can you tell me exactly how I can DM you ? I can’t find any envelop clicking on the avatar so I tried to pass by the moderator section. I got a “no permission” error :

Solved in 8.2.1 (cc @Logan )

1 Like