Code Monkey home page Code Monkey logo

Comments (10)

kylerob avatar kylerob commented on August 27, 2024 1

@FHoxhaDev Full fix is on this branch, try it out and let me know if it works for you:

"pdf2json": "github:kylerob/pdf2json#fix-createScratchCanvas-import"

It looked good in my tests.

from pdf2json.

JinhooBong avatar JinhooBong commented on August 27, 2024 1

@kylerob by pointing my "pdf2json" in package.json will it point to your branch?

EDIT: it does resolve that issue. Thanks Kyle!

from pdf2json.

modesty avatar modesty commented on August 27, 2024 1

thanks to @kylerob. A more thorough fix plus appropriate tests are in PR #338, please review and test it out

from pdf2json.

FHoxhaDev avatar FHoxhaDev commented on August 27, 2024

Hi @modesty,

Is this an issue with Vercel or with the package itself? Is there any workaround to fix this error?

from pdf2json.

kylerob avatar kylerob commented on August 27, 2024

It's an issue with Vercel and executing this code on the server side due to edge functions. The issue is all of these files, the first of which you're seeing an error for, can't be read on the edge function because it hasn't been copied over by Vercel's edge function setup code. Vercel usually does a good job including what you need, but that's if you're importing code via module imports. This code is building up a string of all those file contents and eval'ing it.

I have a fork with a semi-working version that creates the big import file in a separate step, and then imports it into the main files so Vercel includes everything. I'm working on fixing an issue with a canvas function that's defined in one file and used in another that's not working, but you can try it out if you want. If I get it working today I'll create a PR in the main repo to get it merged into the baseline.

from pdf2json.

FHoxhaDev avatar FHoxhaDev commented on August 27, 2024

Hi @kylerob ,

Thank you for your fix. Unfortunately, for me it didn't work. It is failing at my API call where it uploads the file, this is my endpoint:

https://gist.github.com/FHoxhaDev/59e2dc2b1cc134b6d064b96573a51145

and this is the error:

image

Locally it works but not on Vercel host.

from pdf2json.

kylerob avatar kylerob commented on August 27, 2024

@FHoxhaDev Try forcing a redeploy on Vercel -- I ran into the same issue at first. Vercel seems to cache npm packages, because I've had trouble getting it to bring in my latest npm changes sometimes.

from pdf2json.

adpadillar avatar adpadillar commented on August 27, 2024

Hey @kylerob, thanks for your fix!

I just wanted to ask some quick questions.

  1. Any plans on making a PR with this fix at any point?
  2. If not, any plan to publish a separate npm package with your fork

I ask so we can install by doing a normal "pdf2json": "x.x.x" or even a "vercel-pdf2json": "x.x.x" instead of the current github thing

Cheers!

from pdf2json.

kylerob avatar kylerob commented on August 27, 2024

@modesty Thanks for bringing it home!

from pdf2json.

modesty avatar modesty commented on August 27, 2024

fixed in 3.1.2

from pdf2json.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.