Hey Community,
I experience an issue with a dependency I use for converting images.
I automatically want to convert attachments in HEIC format, as we can’t work with that format when processing the tickets.
After researching for options, I decided to go for a combination of HEIC Convert (for the conversion) and Unirest (for uploading the converted heics in a ticket comment).
I was able to successfully convert and upload the converted pics in test environment.
But I experience issues when using heic-convert in production:
async function convertFile(fileUrl, name) {
try {
const heicFile = await getFile(fileUrl);
console.log(heicFile);
console.log(convert);
const jpgFile = await convert({
buffer: heicFile, // the HEIC file buffer
format: 'JPEG', // output format
quality: 1 // the jpeg compression quality, between 0 and 1
});
console.log(jpgFile);
return {
"name": name.replace(/\.[^.]+$/, '_converted.jpg'),
"file": jpgFile
}
} catch (error) {
// Log the error and end the function execution
console.error(error);
return null;
}
}
Logs from test environment:
Ticket 1910084, sample1.heic (type image/jpeg) - convert to JPG
<Buffer 00 00 00 18 66 74 79 70 6d 69 66 31 00 00 00 00 6d 69 66 31 68 65 69 63 00 00 01 fe 6d 65 74 61 00 00 00 00 00 00 00 21 68 64 6c 72 00 00 00 00 00 00 … 293558 more bytes>
[AsyncFunction: one] { all: [AsyncFunction: all] }
<Buffer ff d8 ff e0 00 10 4a 46 49 46 00 01 01 00 00 01 00 01 00 00 ff db 00 84 00 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 … 2194927 more bytes>
Logs from production:
Time | Id | Message |
---|---|---|
Jan 4, 2024, 4:10:44 PM | 65e58 | Ticket 2053287, sample1.heic (type application/octet-stream) - convert to JPG |
Jan 4, 2024, 4:10:44 PM | 65e58 | <Buffer 00 00 00 18 66 74 79 70 6d 69 66 31 00 00 00 00 6d 69 66 31 68 65 69 63 00 00 01 fe 6d 65 74 61 00 00 00 00 00 00 00 21 68 64 6c 72 00 00 00 00 00 00 … 293558 more bytes> |
Jan 4, 2024, 4:10:44 PM | 65e58 | [AsyncFunction: one] { all: [AsyncFunction: all] } |
In difference to test, production stops exactly when I do the conversion.
Why? An exception would be catched and I would see the error log, wouldn’t it? Does the “await convert…” never return?
Or what is happening here?
Hope for some help!
All the best,
Tom