Hi I'm newbie in android!
I want to upload image file from android client to server(Server makes thumbnail, and return thumbnail's url).
However I stucked in this error message.
{"errorMessage":"RequestId: 8e2a21b8-e62e-11e8-8585-d9b6fdfec9b9 Process exited before completing request"}!
I tried to find this error code in stackoverflow, but i cannot found answer for android.
Please help or give me link where I can solve this problem...
Here is server code.
const AWS = require('aws-sdk');
const multipart = require("parse-multipart");
const s3 = new AWS.S3();
const bluebird = require('bluebird');
exports.handler = function(event, context) {
    let result = [];
    const bodyBuffer = new Buffer(event['body-json'].toString(), 'base64');
    const boundary = multipart.getBoundary(event.params.header['Content-Type']);
    const parts = multipart.Parse(bodyBuffer, boundary);
    const files = getFiles(parts);
    return bluebird.map(files, file => {
        console.log('UploadCall');
        return upload(file)
        .then(
            data => {
                result.push({
                    'bucket': data.Bucket,
                    'key': data.key,
                    'fileUrl': file.uploadFile.fullPath })
                console.log( `DATA => ${JSON.stringify(data, null, 2 )}`);
                },
                err => {
                    console.log(`S3 UPLOAD ERR => ${err}`);
                }
            )
        })
        .then(_=> {
            return context.succeed(result);
        });
    }
    let upload = function(file) {
        console.log('PutObject Call')
        return s3.upload(file.params).promise();
    };
    let getFiles = function(parts) {
    let files = [];
    parts.forEach(part => {
        const buffer = part.data
        const fileName = part.filename;
        const fileFullName = fileName;
        const originBucket = 'dna-edge/images';
        const filefullPath = `https://s3.ap-northeast-2.amazonaws.com/${originBucket}/${fileFullName}`;
        const params = {
            Bucket: originBucket,
            Key: fileFullName,
            Body: buffer
        };
        const uploadFile = {
            size: buffer.toString('ascii').length,
            type: part.type,
            name: fileName,
            fullPath: filefullPath
        };
        files.push({ params, uploadFile })
    });
    return files;
};
And this is client code.(imgURL looks like /storage/emulated/0/DCIM/img/1493742568136.jpg)
public static String requestHttpPostLambda(String url, String imgURL){
    /*
     await axios.post(`${AWS_LAMBDA_API_URL}?type=${type}`, formData,
{ headers: { 'Content-Type': 'multipart/form-data' }})
.then((response) => {result = response});
     */
    String result=null;
    try {
        HttpClient client = new DefaultHttpClient();
        String postURL = url;
        HttpPost post = new HttpPost(postURL);
        post.setHeader("Content-Type", "multipart/form-data");
        File file = new File(imgURL);
        MultipartEntityBuilder builder = MultipartEntityBuilder.create();
        builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
        builder.addPart("image", new FileBody(file));
        post.setEntity(builder.build());
        HttpResponse responsePOST = client.execute(post);
        Log.e("HttpResponse", responsePOST.getStatusLine()+"");
        HttpEntity resEntity = responsePOST.getEntity();
        if (resEntity != null) {
            result = EntityUtils.toString(resEntity);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return result;
}
 
    