-
Notifications
You must be signed in to change notification settings - Fork 454
Description
Hello,
I am trying to run the Open Notebook application using the provided Docker image and a Google Gemini API key. I am consistently running into an "API key not valid" error, and after extensive debugging, I've concluded it's an issue with the Docker image's dependencies.
Steps to Reproduce:
Set up docker-compose.yaml and a .env file (or direct environment variables).
Enable the Vertex AI API in the corresponding Google Cloud Project, as required for production use.
Configure the docker-compose.yaml with GOOGLE_API_KEY, VERTEX_PROJECT, and VERTEX_LOCATION.
Start the containers with docker compose up -d.
Attempt to add a PDF or web link as a source.
Observed Behavior:
The application fails with a 500 Internal Server Error, and the logs show:
"detail":"Error creating source: Google API error: API key not valid. Please pass a valid API key."
Debugging Steps Taken:
API Key is Valid: I have verified the API key works perfectly outside of Docker using a simple Python script with the google-generativeai library.
Container Network is Working: I have exec'd into the running container, installed curl, and successfully connected to https://generativelanguage.googleapis.com. There are no network or firewall issues.
Service Account Failure: When I configure the application to use a Service Account JSON key (GOOGLE_APPLICATION_CREDENTIALS), the application crashes with the error: [Errno 2] No such file or directory: 'gcloud'.
Conclusion:
The application's logic correctly attempts to use a more robust authentication method (likely ADC via gcloud) when it detects a Vertex AI configuration. However, the gcloud SDK is not included in the lfnovo/open_notebook:latest Docker image, causing the authentication to fail. This forces users into a configuration loop where no valid authentication method works.
Suggested Fix:
The gcloud command-line tools (Google Cloud SDK) need to be added to the Dockerfile and included in the Docker image so that standard Vertex AI authentication can succeed.