You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ServiceOptions.java: Extract projectId from credentials when provided via .setCredentials` #3386
when .setCredentials is used, the project id is not extracted from the service account.
This behavior is different when service account credentials are supplied via GOOGLE_APPLICATION_CREDENTIALS env var (project id is extracted)
ServiceOptions sets projectId and credentials separately. It would first look for projectId in this sequence, and then look for credentials in this sequence. The reason you have the same projectId when you set the credentials through GOOGLE_APPLICATION_CREDENTIALS is that this json file is the first place ServiceOptions looks for both projectId and credentials if neither of them is set explicitly.
Though there has been discussions over whether we should extract the projectId from a ServiceAccountCredentials when the credentials is explicitly passed to the ServiceOptions, we generally consider the current behavior intended. Besides, it is possible that users might want the projectId to be different from what is provided in the ServiceAccountCredentials json file.
We encourage people to use GOOGLE_APPLICATION_CREDENTIALS environment variable over other authentication approaches whenever possible. If you have to manually create and set a credentials, please also set the projectId:
Activity
jabubake commentedon Jun 15, 2018
@hostirosti FYI
hostirosti commentedon Jun 15, 2018
Example:
yihanzhen commentedon Jun 15, 2018
ServiceOptionssetsprojectIdandcredentialsseparately. It would first look forprojectIdin this sequence, and then look forcredentialsin this sequence. The reason you have the sameprojectIdwhen you set the credentials throughGOOGLE_APPLICATION_CREDENTIALSis that this json file is the first placeServiceOptionslooks for bothprojectIdandcredentialsif neither of them is set explicitly.Though there has been discussions over whether we should extract the
projectIdfrom aServiceAccountCredentialswhen thecredentialsis explicitly passed to theServiceOptions, we generally consider the current behavior intended. Besides, it is possible that users might want theprojectIdto be different from what is provided in theServiceAccountCredentialsjson file.We encourage people to use
GOOGLE_APPLICATION_CREDENTIALSenvironment variable over other authentication approaches whenever possible. If you have to manually create and set acredentials, please also set theprojectId:feat: support DML auto-batching in Connection API (#3386)
chore(main): release 6.79.0 (#3400)