Cloud Function - Google storage to BQ table

I am uploading the file from Google Storage Bucket to the BQ table. I am running a Cloud Function similar to shown below. I am able to run and deploy it successfully but I could see many files are not getting uploaded to the BQ table. I am getting the error[1] .

 I am not even using the flask. How do I understand this error?

error[1] 

"response = self.full_dispatch_request() :

at .wsgiu_app (.....pip/lib/python3.12/site-packages/flask.app.pt:2529)"

Cloud Function :

from google.cloud import storage, bigquery

def move_to_bigquery(data, context):

bucket_name = data['bucket']

file_name = data['name']

project_id = 'your-project-id'

dataset_id = 'your-dataset-id'

table_id = 'your-table-id'

gcs_uri = f"gs://{bucket_name}/{file_name}"

job_config = bigquery.LoadJobConfig( autodetect=True, source_format=bigquery.SourceFormat.NEWLINE_DELIMITED_JSON, )

table_ref = bigquery_client.dataset(dataset_id).table(table_id)

load_job = bigquery_client.load_table_from_uri(gcs_uri, table_ref, job_config=job_config)

load_job.result()

0 1 144
1 REPLY 1

Hello @Rhountu,

Welcome to the Google Cloud Community!

Have you enabled Cloud Function logs? Can you check and share for any errors or warnings logged during execution, especially concerning the BigQuery load job.

Meanwhile, please review your requirements.txt file for any libraries that might depend on Flask. Additionally, if you identify a library you no longer need, remove it from requirements.txt and redeploy your Cloud Function after making the necessary changes.