Nodejs sharp error - Input file contains unsupported image format might be a race condition
November 2021
Was doing some S3 work where I had fs.writeFile that worked locally but not on the server.
Realized that it was causing a race condition with sharp.
Fix was to flip over to using fs.writeFileSync so the process didn't move on until the file was finished writing
- https://www.geeksforgeeks.org/node-js-fs-writefilesync-method/
end of line