Custom Headers on document load being ignored

PDF.js Express Version – 7.3.3

Detailed description of issue
Trying to add custom headers on document load to send some extra information, and the headers aren’t being set on the request

I’ve tried multiple iterations of this as well, with the same results.

Expected behaviour
The headers are set on every request

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

Code snippet

useEffect(() => {
    if (!viewerInstance) return;

    const customHeaders = Object();
    customHeaders["X-HL-Current-Organization"] = getCurrentOrgId();
    customHeaders.test = "header";

    const { docViewer } = viewerInstance;
    docViewer.loadDocument(`/v1/chart/${chartId}/pdf`, {
      extension: "pdf",
      httpHeaders: customHeaders,
  }, [viewerInstance]);

I’ve also tried this with the same result:

 useEffect(() => {
    if (!viewerInstance) return;

    viewerInstance.loadDocument(`/v1/chart/${chartId}/pdf`, {
      extension: "pdf",
      customHeaders: { "X-HL-Current-Organization": getCurrentOrgId() },
  }, [viewerInstance]);

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,

Thanks for the bug report - I can reproduce this issue and will have a fix ready for the next release.

Ill post in #announcements when it’s released.