Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ERROR resolvePDFJS is not a function #18

Closed
cosbgn opened this issue Oct 2, 2024 · 7 comments
Closed

ERROR resolvePDFJS is not a function #18

cosbgn opened this issue Oct 2, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@cosbgn
Copy link

cosbgn commented Oct 2, 2024

Environment

ERROR resolvePDFJS is not a function happens on the lastest v0.12 - v11 works fine

Reproduction

import { extractText, getDocumentProxy } from "unpdf";

Describe the bug

ERROR resolvePDFJS is not a function

Additional context

No response

Logs

No response

@cosbgn cosbgn added the bug Something isn't working label Oct 2, 2024
@cosbgn
Copy link
Author

cosbgn commented Oct 2, 2024

deleting node_modules fixed it. Sorry for bothering.

@cosbgn cosbgn closed this as completed Oct 2, 2024
@johannschopplich
Copy link
Collaborator

Probably the dependency wasn't up to date. Thanks for checking!

@parhammmm
Copy link

@johannschopplich this actually is a valid issue, I had to use the following to get things working, even though I'm not using a serverless environment. I'm not quite sure what's caused the issue.

    await configureUnPDF({
      pdfjs: () => import("pdfjs-serverless"),
    });

@johannschopplich
Copy link
Collaborator

@parhammmm It seems like your code is invalid. import("pdfjs-serverless") is not a valid option for parameter pdfjs. You don't need to set this parameter, except you want to the official PDF.js library (which wont't work in serverless environments), like this:

await configureUnPDF({
  // Use the official PDF.js build (make sure to install it first)
  pdfjs: () => import("pdfjs-dist"),
});

Please open a separate issue if you encounter a bug, don't add notes to this closed issue. Thanks!

@parhammmm
Copy link

parhammmm commented Oct 8, 2024

@johannschopplich I tried that and that did not work. But the serverless did

I opened a separate PR: #19

Thanks for taking a look :)

@parhammmm
Copy link

@johannschopplich can confirm the fix works

@unjs unjs deleted a comment Oct 24, 2024
@johannschopplich
Copy link
Collaborator

Thanks a lot for confirming it! Closing it, since resolved.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants