Nikita Makarov commited on
Commit
c32d840
·
1 Parent(s): 2c4e0c3

Debug API key access in Modal

Browse files
Files changed (1) hide show
  1. modal_proxy.py +5 -1
modal_proxy.py CHANGED
@@ -27,9 +27,13 @@ def search_youtube(query: str, limit: int = 5) -> Dict[str, Any]:
27
  # YouTube Data API v3 search endpoint
28
  url = "https://www.googleapis.com/youtube/v3/search"
29
  # Get API key from Modal secret
 
30
  api_key = os.environ.get("YOUTUBE_API_KEY", "")
31
  if not api_key:
32
- return {"success": False, "error": "YouTube API key not found in environment", "tracks": []}
 
 
 
33
 
34
  params = {
35
  'part': 'snippet',
 
27
  # YouTube Data API v3 search endpoint
28
  url = "https://www.googleapis.com/youtube/v3/search"
29
  # Get API key from Modal secret
30
+ # Modal secrets are available as environment variables with the same name as the secret
31
  api_key = os.environ.get("YOUTUBE_API_KEY", "")
32
  if not api_key:
33
+ # Try alternative names that Modal might use
34
+ api_key = os.environ.get("youtubeapikey", "")
35
+ if not api_key:
36
+ return {"success": False, "error": f"YouTube API key not found. Available env vars: {list(os.environ.keys())}", "tracks": []}
37
 
38
  params = {
39
  'part': 'snippet',