WASM-ImageMagick: Uncaught TypeError: Cannot read property 'getSync' of undefined

magickApi.js:78 Uncaught TypeError: Cannot read property 'getSync' of undefined
    at Object../node_modules/wasm-imagemagick/dist/src/magickApi.js (magickApi.js:78)

success after removing .default on line 78

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 8
  • Comments: 16 (5 by maintainers)

Most upvoted comments

I have done something like this now and it works like a charm, a bit hacky though:

<script type="module">
  import * as Magick from "https://knicknic.github.io/wasm-imagemagick/magickApi.js";

  window.magick = Magick;
</script>

I’m importing this package into a react app, and encountering this problem. Deleting the .default works, but is there a workaround that doesn’t involve modifying the contents of my node_modules, as this will be undone when it is built by my CI pipeline?

@JohnForster I can’t vouch for it in the way it sounds like you’re asking, but I don’t see anything in the changelog that indicates that there have been any security vulnerabilities that have been patched in the two releases since. My team and I thought to try 1.1.0 because it’s the version being used i n the CodeSandbox demo example given in the README for the project: https://codesandbox.io/s/wasm-imagemagick-basic-demo-y00u2. You could also try 1.2.0 and see if that works? Or, as @EmperorArthur mentioned above, you could just compile this repo from source, and it may work then: #53 (comment). Good luck!

There are a few security alerts that are raised for this project by a github bot… I should start merging some of them in, however since I use this project on a completely static website I am not too concerned about users hacking themselves.

@wind4gis I originally wrote this code directly in es6. cancerberoSgx came along and added in type script, tests and npm support.

From what I understand es5 is not working for commonjs. @Axure wrote a PR to address this issue, however it breaks the tests. I reran the tests today to validate they are in fact still failing.

@wind4gis you are more then welcome to adopt @Axure’s PR and resubmit a forked version that doesn’t break the tests

I will assure you the library does work, it has been used to save over 2500 hours of artists’ time at https://knicknic.github.io/croppy

You can view the entirety of the source code for in that page (not minified) or at https://github.com/KnicKnic/croppy