Skip to content
Advertisement

Why does my Lambda function write an empty csv file to S3?

I’m calling the YouTube API to download and store channel statistics in S3. I can write a csv file to my S3 bucket without any errors, but it’s empty. I have checked this thread Why the csv file in S3 is empty after loading from Lambda, but I’m not using a with block in to_csv_channel().

I’m currently running the script locally with Windows task scheduler with a slightly modified to_csv_channel() method that appends data to an existing csv, but in this case I would like to write a new csv file to S3 every day.

JavaScript

My lambda_handler:

JavaScript

Any help would be appreciated.

Advertisement

Answer

JavaScript

S3 Service Resource

similar post : How to write a file or data to an S3 object using boto3

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement