I made an electron app that uses the Gemini API key. In development, it works perfectly fine with the API key. However, once I use electron-packager to package it for distribution, it starts throwing the following error:
Error: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.
Here is the code I used to load my API key:
const API_KEY = process.env.API_KEY;
To re-iterate, the API key works just fine prior to packaging. It’s only after packaging that Gemini starts asking for ADC. According to this page, I shouldn’t need ADC if I have an API key, so why is this happening?
Here is a screenshot for an example: