Error: Runtime exited with error: exit status 129

Viewed 3487

I have added the following code to the lambda function to get a part of a zip file uploaded to my s3 bucket.

const AWS = require("aws-sdk");
const s3 = new AWS.S3();
const file = require('fs').createWriteStream('part1');

exports.handler = (event, context, callback) => {
    const params = {
        Bucket: 'myBucketName',
        Key: 'myFolder/testZip.zip',
        Range: 'bytes=0-3652539'
    };
    s3.getObject(params).createReadStream().pipe(file);
};

The response to the lambda is throwing an error as follows.

Response:
{
  "errorMessage": "RequestId: c1e4d549-b4f5-47b7-bcde-bc9a31faf731 Error: Runtime exited with error: exit status 129",
  "errorType": "Runtime.ExitError"
}

Please Help me to download the chunk i have mentioned from lambda.

1 Answers

The const file should be var file and the file path should be /tmp/test1:

const AWS = require("aws-sdk");
const s3 = new AWS.S3();
var file = require('fs').createWriteStream('/tmp/part1');

exports.handler = (event, context, callback) => {
    const params = {
        Bucket: 'myBucketName',
        Key: 'myFolder/testZip.zip',
        Range: 'bytes=0-3652539'
    };

    s3.getObject(params).createReadStream().pipe(file);
};

Note: The above should address your current issue (exit status 129). I can't verify that everything else is correct or that it works.

Related