question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using browser-image-compression npm package causes "infinite wait"

See original GitHub issue

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 👍

Issue Analytics

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

github_iconTop GitHub Comments

4reactions
rricamarcommented, Mar 2, 2020

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 🙏

2reactions
sanex3339commented, Mar 9, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

browser-image-compression - npm
Features. You can use this module to compress jpeg and png images by reducing resolution or storage size before uploading to the application ......
Read more >
compress base64 image npm - Bro Science Bible
Start using compress-images in your project by running `npm i ... statistics from the GitHub repository for the npm package browser-image-compression, ...
Read more >
How to Compress an Image in React (in 2023) | AbstractAPI
Compress Images Using Browser Image Compression · Get Started. First, download the package from NPM. npm install --save browser-image-compression.
Read more >
Top 5 browser-image-compression Code Examples - Snyk
Learn more about how to use browser-image-compression, based on browser-image-compression code examples created from the most popular ways it is used in ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found