@Rahul_Parmar known regression since n8n 1.98 when pdfjs-dist was upgraded to a version that needs browser APIs like DOMMatrix — multiple github issues open on it (#16593, #16438, #16422). workaround that works on 2.23.0 without downgrading: bypass Document Loader for PDFs and use a Code node with the pdf-parse npm package instead. set NODE_FUNCTION_ALLOW_EXTERNAL=pdf-parse in ur env vars, extract the text in Code node, pass the extracted text into Vector Store Insert directly. is the rest of ur workflow heavily tied to Document Loader specifically, or just using it for PDF text extraction?
I was previously using 2.21.7, but I upgraded because of the pdf-parse v1.1 issue reported in “Error in Node Default Data Loader” , which appears to have been fixed in 2.23.0.
However, after upgrading, I’m now hitting the DOMMatrix is not defined error specifically during PDF ingestion in the Document Loader node.
@Rahul_Parmar
I didn’t find any issues with your code, it might be an environment compatibility problem.
change the typeversion to 1.0, this forces the loader to use pdf-parse instead of pdfjs-dist, eliminating the DOM dependency or add a Code node as a polyfill before the loader.
I have the same problem as reported above (DOMMatrix is not defined). As you suggested I’ve reverted the Data Loader to typeversion 1.0, added a Recursive Character Text Splitter to the node, but I’m still getting the (DOMMatrix is not defined) error.
(I have n8n self hosted and I’m using version 2.23.1, since as the person posting the original issue, I was also getting pdf-parse v1.1 issue reported in “Error in Node Default Data Loader”.
hi @atdev150, welcome to the n8n community.
each case is different, it’s necessary to evaluate your json. please open a question so the community can support you directly or check if my previous answer also helps you.
I just wanted to know which n8n version you tested this on. Also, did you use the same Document Ingestion workflow? Were you able to successfully upload and process a PDF using it?
While waiting for the official fix, a working workaround on self-hosted is to swap the Document Loader node for a Code node that uses pdf-parse instead. If you add NODE_FUNCTION_ALLOW_EXTERNAL=pdf-parse to your n8n environment variables and install the package in the container, you can parse the PDF binary directly without the DOMMatrix dependency:
Hello, in my opinion the issue has been definitively resolved with version 2.23.4. Many thanks to everyone who pursued this matter so persistently! Best regards, Thomas
Actually, the problem hasn’t been resolved yet. The “DOM Matrix is not defined” error appears again in version 2.25.7. In version 2.23.4, the workflow runs smoothly. The workflow also runs smoothly in the “unofficial” version 2.26.0.