Quantcast
Channel: Active questions tagged aws-lambda - Stack Overflow
Viewing all articles
Browse latest Browse all 4012

File corrupts when uploading using pre-signed url with AWS Lambda

$
0
0

I am trying to load files uploaded using Angular application to S3 using presigned URL but file gets corrupted after upload. It works using postman.

Lambda FastAPI function to handle the upload-

async def temp_upload_file_to_s3(email_id: str = Form(...),file: List[UploadFile] = File(...),db: connection = Depends(get_db_connection)):    s3_client = boto3.client('s3')    for file1 in file:        key = 'raw/'+ file1.filename        presigned_url = await generate_presigned_url(key, 'put_object')        print(presigned_url)        response = requests.put(presigned_url, data=await file1.read())        print(response)    return {"status": "success", "message": "Files uploaded to S3"}

Viewing all articles
Browse latest Browse all 4012

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>