Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[s3-image-size fork] Callback sometimes not executed #6

Open
vincentwinkel opened this issue Jun 4, 2021 · 0 comments
Open

[s3-image-size fork] Callback sometimes not executed #6

vincentwinkel opened this issue Jun 4, 2021 · 0 comments

Comments

@vincentwinkel
Copy link

I use s3-image-size which is a fork of this repo (I cannot create an issue on it).
Sometimes I never enter inside the callback (error happens often with a file > 40Mb, or 3 files of 3Mb).
Code:

  static async _getImageDimensions(file) {
    const s3 = this._initS3();
    return new Promise((resolve, reject) => {
      const time = Date.now();
      console.log('PROMISE', time, file.bucket, file.key);
      size(s3, file.bucket, file.key, (err, dimensions, bytesRead) => {
        console.log('RESULT', time, err, dimensions);
        if (err) {
          reject(err);
        } else {
          resolve({
            width: dimensions.width,
            height: dimensions.height
          });
        }
      });
    });
  }

Result:

PROMISE 1622809206369 bucketName c40c6fdba85f7c31bc99af6f.png
PROMISE 1622809206369 bucketName b540615c5739888cbaacd52a.png
PROMISE 1622809206370 bucketName 56c009d08fa72ea6134eea88.png
RESULT 1622809206369 null { width: 3984, height: 1538, type: 'png' }
RESULT 1622809206370 null { width: 3984, height: 1538, type: 'png' }
//process stuck here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant