javascript-obfuscator: Using browser-image-compression npm package causes "infinite wait"

Hi, I´m using https://www.npmjs.com/package/browser-image-compression for compress some images on my web app. The fact is that when I obfuscate the code, the library call never returns, resulting in an “infinite wait”. I know that is this calls because I put a lot of logs for debug this, but no error is given 😰

Without obfuscating it, it works.

Your Environment

  • Obfuscator version used: 0.25.2
  • Node version used: 10.16.3

Stack trace

The library doesn’t produce any error, it just gets stuck

Minimal working example that will help to reproduce issue

async reduceImages(files: File[]): Promise<File[]> {
    return Promise.all(
      files.map(async (file: File) => {
        try {
          const resizedImage = await this.imageCompression(file, {
            maxWidthOrHeight: 1200, // px
          });
          return resizedImage;
        } catch (error) {
          this.logger.warn('Resize error:', error);
          return file;
        }
      }),
    );
  }

I can upload the obfuscated javascript file if needed 👍

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 19 (12 by maintainers)

Most upvoted comments

Hi, please take a look to:

https://github.com/rricamar/javascript-obfuscator-566

It’s a repo with a minimal working of obfuscation not working. If I use the non-obfuscated option it works. Anything please let me know.

Steps to reproduce:

  1. Try load an image (I left two inside the project)
  2. Without obfuscation you’ll see a success alert,
  3. Using obfuscated files, it doesn’t work

Ty as always 🙏

Yes, try to disable web worker. And use 0.25.4 version. You should disable web worker anyway.

Thank you, will check it

yes