Inconsistent behavior between GOOGLE_CLOUD_PROJECT and ProjectIdOption #11742
Labels
api: storage
Issues related to the Cloud Storage API.
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
We have at least 2 ways to send the project id in the storage library. The
GOOGLE_CLOUD_PROJECT
environment variable, theProjectIdOption
that can be used withgoogle::cloud::Options
. It seems that some functions only use one and not the other. And some functions consume aproject_id
parameter for extra fun.We need to make this consistent. Application developers should not need to guess which one applies. Keep in mind the option precedence hierarchy.
Make that 3. For HMAC keys we also have
OverrideDefaultProject
. Sigh.The story of how we got here is hilarious, but does not fix anything.
This issue is from https://stackoverflow.com/questions/76345053/how-to-set-the-project-id-for-c-storage-client
User ADC: If the environment variable
GOOGLE_CLOUD_PROJECT
is set, theCreateV4SignedUrl
works without specifying the SigningAccount parameter. If the environment variable is not set, then the SigningAccount parameter is required.However, the Project ID should be able to be set via the
gcs::Client()
optiongcs::ProjectIdOption>(project_id)
, but that seems to be implemented but never processed later in the code.Originally posted by @jhanley-com in #11740 (comment)
The text was updated successfully, but these errors were encountered: