hi, I try to implement the Langchain pdf loader into my application. But if I call `loader.load()` I

hi, I try to implement the Langchain pdf loader into my application. But if I call loader.load() I always get the error message: RangeError: Maximum call stack size exceeded Does someone know what could be the cause? I have already tried it with small pdf files, but that didn't help either

notes.post('/', async (c: CustomContext) => {
    // Need to polyfill a method that Cloudflare Workers is missing for the PDF loader
  globalThis.setImmediate = ((fn: () => {}) => setTimeout(fn, 0)) as any
    const cloudflareFetchResponse = await fetch(
        'https://www.cloudflare.com/resources/assets/slt3lc6tev37/3HWObubm6fybC0FWUdFYAJ/5d5e3b0a4d9c5a7619984ed6076f01fe/Cloudflare_for_Campaigns_Security_Guide.pdf'
    )
    const cloudflarePdfBlob = await cloudflareFetchResponse.blob()
    const laoder = new WebPDFLoader(cloudflarePdfBlob)
    const docs = await loader.load() //RangeError: Maximum call stack size exceeded

The part of this code is from the langchain repository https://github.com/jacoblee93/langchain-nuxt-cloudflare-template

Thanks
GitHub
Contribute to jacoblee93/langchain-nuxt-cloudflare-template development by creating an account on GitHub.
Was this page helpful?