Skip to content

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

@vincentwinkel

Description

@vincentwinkel

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions