I've successfully created a lambda function that resizes an image and stores into a bucket in s3(bucket name:cropped
).
Also this lambda function invokes when a file is uploaded into another bucket(bucket name:source
).
When i upload an image through aws console into the source
bucket the AWS lambda function is triggered and the cropped image is created in cropped
bucket.
But when i try with programmatic file upload ( s3 browser file upload) the lambda function is not triggered(cropped image is not creating in cropped
bucket) however the image is successfully uploaded into source
bucket.
Browser file upload
<form id="upload" action="//s3-us-west-2.amazonaws.com/lambdacushbu" method="POST" enctype="multipart/form-data">
<input type="hidden" name="Content-Type" value="multipart/form-data" />
<input type="hidden" name="acl" value="private" />
<input type="hidden" name="success_action_status" value="201" />
<input type="hidden" name="policy" value="eyJleHBpcmF0aW9uIjoiMjAxNy0wMy0yNFQxMTo0NDoxMFoiLCJjb25kaXRpb25zIjpbeyJidWNrZXQiOiJsYW1iZGFjdXNoYnUifSx7ImFjbCI6InByaXZhdGUifSxbInN0YXJ0cy13aXRoIiwiJGtleSIsIiJdLFsiZXEiLCIkQ29udGVudC1UeXBlIiwibXVsdGlwYXJ0XC9mb3JtLWRhdGEiXSxbImNvbnRlbnQtbGVuZ3RoLXJhbmdlIiwwLDUyNDI4ODAwMF0seyJzdWNjZXNzX2FjdGlvbl9zdGF0dXMiOiIyMDEifSx7IngtYW16LWNyZWRlbnRpYWwiOiJBS0lBSlJWRVhVVFRWTjROWUFSUVwvMjAxNzAzMjRcL3VzLXdlc3QtMlwvczNcL2F3czRfcmVxdWVzdCJ9LHsieC1hbXotYWxnb3JpdGhtIjoiQVdTNC1ITUFDLVNIQTI1NiJ9LHsieC1hbXotZGF0ZSI6IjIwMTcwMzI0VDA1NDQxMFoifV19" />
<input type="hidden" name="X-amz-credential" value="AKIAJRVEARQ/20170324/us-west-2/s3/aws4_request" />
<input type="hidden" name="X-amz-algorithm" value="AWS4-HMAC-SHA256" />
<input type="hidden" name="X-amz-date" value="20170324T054410Z" />
<input type="hidden" name="X-amz-signature" value="854ea7ec0c456c03509d22a6de39b045e54b71a779af8d88175717d8b54ccebc" />
<input type="hidden" name="key" value="${filename}" />
<input type="file" name="file" id="image">
<br>
<input type="submit" value="upload" name="upload">
<span id="status-text"></span>
<img src="" id="cropped-image">
</form>
UPDATE
I've tried with normal file upload method ie user uploads file to my server and then it put into aws s3 bucket. Now its working
So i think there is an issue with direct browser upload