AWS S3 bucket with netlify app not working in production

My function and route to upload images to my s3 bucket works fine in development/localhost but my s3.upload callback never gets ran in production im assuming? I never get the log back in my netlify server.js lambda function console but i get every single other one even the “Upload finished” log and its never posting my image to my bucket?

Ive made sure that all my bucket role and policies are allowing full access and i have my .env variables on netlify in my server settings.

I thought maybe my everything else is just finishing faster than the s3.upload callback but ive tried many different ways of fixing it maybe anyone knows what i should do?

function uploadProfilePicToS3(file) {
let s3bucket = new AWS.S3({
accessKeyId: process.env.AWS_USER,
secretAccessKey: process.env.AWS_SECRET,
Bucket: process.env.AWS_BUCKET,
});
console.log("secret log ", process.env.AWS_SECRET);
var params = {
Bucket: BUCKET_NAME,
Key: instacloneprofilepics/${file.name},
Body: file.data,
ACL: “public-read”,
ContentType: file.mimetype,
};
console.log(“this is the image metadeta”, params);

s3bucket.upload(params, function (err, data) {
if (err) {
console.log(“error in callback”);
console.log(err);
return;
}

console.log("POST UPLOADED SUCCESS FROM CALLBACK");

console.log(data);
return data;

});
}

var busboy = new Busboy({ headers: req.headers });
const file = req.files.img;

busboy.on("finish", async function () {
  try {
    await uploadProfilePicToS3(file);

    console.log(file);
    console.log("Upload finished");
  } catch (error) {
    console.log(error, "ERROR ERROR ERROR");
  }
});

req.pipe(busboy);

Hey @hunterfoulk,
Could you please share the Netlify URL where this function is hosted? We can check out the logs and see if we see anything more than what you’re seeing your function logs. And then you have two code blocks there… but are they all the same function or does the second block live in S3? Thanks!