No space left on device with lambda s3 #179
-
Description of the problemHi, To begin thanks a lot for your work. I use AWS Lambda to aggregate a collection of files on one zip. I have seen on the S3Wrapper (register by registerStreamWrapper()) it's use For information with less data it's work perfectly. Have you got an idea just for append files into my zip ? Thanks, Example code$urlCollection : List of S3 url files (~2Mo by content). (Zip attempted ~2Go) $this->client->registerStreamWrapper();
$outputContext = stream_context_create([
's3' => ['ACL' => 'public-read'],
]);
$zipFile = fopen("s3://{my_s3_bucket}/tmp/test.zip", 'w', false, $outputContext); // I have tried to replace 'w' by 'a'
$options = new Archive();
$options->setEnableZip64(false);
$options->setZeroHeader(true);
$options->setOutputStream($zipFile);
$zip = new ZipStream(null, $options);
foreach ($urlCollection as $url) {
if ($streamRead = fopen($url, 'r')) {
$zip->addFileFromStream(basename($url), $streamRead);
} else {
var_dump('fopen error');
}
}
$zip->finish();
fclose($zipFile); Informations
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
I am also using AWS Lambda (with bref) and I am experiencing the exact same problem. $options->setFlushOutput(true); @AnthonyGWeb You haven't by any chance already found a solution for it or debugged it further? I am using the following versions: Stack trace:
|
Beta Was this translation helpful? Give feedback.
-
if anyone spends 2 days killing themselves over this... I had no idea this was an added feature. It fixed the issue we had, which was the same as the one above. Took 30 seconds and took effect instantly. https://aws.amazon.com/blogs/compute/using-larger-ephemeral-storage-for-aws-lambda/ |
Beta Was this translation helpful? Give feedback.
See answer: #277 (reply in thread)