Gemini API File Upload Issue: Permission Denied in Production, Works Locally!

When I upload a file to Gemini for processing, it works locally: I am able to pass it to the model and get a response. However, in production, I keep getting this error: ‘You do not have permission to access the File wq4nsuqe6mxu or it may not exist.’

The time-to-live (TTL) has not been exceeded as the error occurs within minutes of the upload. I am also using the same API key for both the upload_file() and generate_content() calls. Furthermore, I wait for the files to become active before sending them to the model, and I have implemented retry logic and backoff, but to no avail.

Hi @Esan
Welcome to the Google AI Forum!!!

Could you please confirm which model you are using??