I'm trying to resize images with a resolution of 16384x16384 and higher using nodejs sharp. While the function runs fine on a local machine, the problem appears on aws lambda.
I get this error "Runtime.UnhandledPromiseRejection: Error: wbuffer_write: write failed",
"unix error: No space left on device"
The machine has 2024mb memory and works fine on lower resolution images but throws the error using bigger resolutions. The output resolutions are supposed to be 8192 and 4096
I've tried changing the sharp.cache memory, rewriting the function so it sends the file right after .toBuffer yet it didn't help since it throws the error during the .toBuffer function.
I'm a bit out of ideas and would greatly appreciate help.
The problematic bit of code:
async function changeResolution(){
try {
var key = './image.jpg';
var image = sharp(key, { limitInputPixels: false });
return await image
.resize(8192,8192)
.toBuffer()
.then(console.log("I do not get here"))
} catch (error) {
console.log(error);
return;
}
}