BigQuery error in load operation: Access Denied: Job chase-transaction-
history:aws-us-east-1.bqjob_r31b840219a033810_0000018aaeacef05_1: Media upload
not authorized
The “Media upload not authorized” error means that the service account that is running the BigQuery load job does not have permission to upload the CSV file to Cloud Storage.
Possible reasons for this include:
The service account does not have the roles/storage.objectCreator role for the Cloud Storage bucket that contains the CSV file.
The service account does not have the roles/bigquery.dataEditor role for the BigQuery dataset that you are trying to load the data into.
The service account does not have the roles/bigquery.jobUser role for the BigQuery project that you are running the load job in.
To troubleshoot the issue:
Verify that the service account that is running the BigQuery load job has the roles/storage.objectCreator role for the Cloud Storage bucket that contains the CSV file.
Verify that the service account that is running the BigQuery load job has the roles/bigquery.dataEditor role for the BigQuery dataset that you are trying to load the data into.
Verify that the service account that is running the BigQuery load job has the roles/bigquery.jobUser role for the BigQuery project that you are running the load job in.
To grant these permissions, you can use the Google Cloud IAM console or the gcloud command-line tool.
Once you have granted the necessary permissions, you should be able to run the BigQuery load job without getting the “Media upload not authorized” error.