title: sharp seems to return wrong image, why? nodejs
body: <p>I am building an app where we try to resize profile images.</p>
  <p>We do this through our cloud functions in nodejs.</p>
  <pre><code>await fs.ensureDir(workingDir);
  
    await bucket.file(filePath).download({
      destination: tmpFilePath,
    });
  
    const sizes = [
      [128, 128],
      [256, 256],
      [764, 468],
    ];
  
    let uploadPromises = sizes.map(async (size) =&gt; {
      const thumbName = `thumb@${type}&amp;${id}&amp;${size[0]}x${size[1]}&amp;${fileName}`;
      const thumbPath = join(workingDir, thumbName);
  
      try {
        await sharp(tmpFilePath)
          .resize(size[0], size[1])
          .withMetadata()
          .toFile(thumbPath); //I am guessing the issue is with sharp.
  
  
  
  
        await bucket.upload(thumbPath, {
          destination: join(bucketDir, thumbName),
          metadata: {
            metadata: metaData,
          },
        });
  
        return await fs.remove(thumbPath);
  
      } catch (err) {
        return;
      }
    });
  
  
    await Promise.all(uploadPromises);
  
    await fs.remove(workingDir);
    await fs.remove(tmpFilePath);
  
    await fs.remove(bucketDir);
  
    return Promise.resolve();
  </code></pre>
  <p>What happens is that the image get's resized, but it seems that sharp sometimes returns the wrong image. Instead of the intended one it returns one that was recently uploaded.</p>
  <p>Has this happened to anyone?</p>