-
Notifications
You must be signed in to change notification settings - Fork 730
feat(google-pubsub): add Application Default Credentials (ADC) support to Google Pub/Sub connector #24647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(google-pubsub): add Application Default Credentials (ADC) support to Google Pub/Sub connector #24647
Conversation
… Default Credentials support Signed-off-by: tuantran0910 <[email protected]>
…le Cloud Pub/Sub connector Signed-off-by: tuantran0910 <[email protected]>
…n from Google Cloud Pub/Sub connector configuration Signed-off-by: tuantran0910 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR extends the Google Pub/Sub source and sink to support Google Application Default Credentials (ADC), allowing connectors to authenticate without explicitly embedding service account JSON in configuration. It also updates tests and documentation to align with the new ADC-based authentication flow.
Changes:
- Remove hard requirements for explicit
pubsub.credentials/pubsub.emulator_hostin the Pub/Sub source and sink, and wire the sink to useDefaultTokenSourceProvider(ADC) when neither is provided. - Enhance error messages for missing Pub/Sub subscriptions and failed ADC initialization to guide users toward correct ADC configuration (env vars,
gcloud auth application-default login, workload identity). - Update the Pub/Sub SLT test to expect ADC-related initialization errors and add documentation describing how to configure and test ADC-based authentication for connectors.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/connector/src/source/google_pubsub/enumerator/client.rs |
Relaxes the previous “credentials or emulator required” constraint and augments the subscription-not-found error message with ADC configuration guidance. |
src/connector/src/sink/google_pubsub.rs |
Changes sink environment selection to fall back to Google ADC (DefaultTokenSourceProvider::new) when no explicit credentials or emulator host are provided, with a detailed error message on ADC failure. |
e2e_test/source_inline/pubsub/pubsub.slt.serial |
Adjusts the expected error for creating a Pub/Sub source without credentials to match the new ADC-based initialization failure path. |
docs/dev/src/connector/intro.md |
Adds a section explaining how to configure and use ADC (locally and in CI/CD) for Google Pub/Sub connector testing. |
| If not using emulator, ensure Google ADC is configured: \ | ||
| set `pubsub.credentials` parameter, or configure GOOGLE_APPLICATION_CREDENTIALS_JSON/GOOGLE_APPLICATION_CREDENTIALS environment variables, \ | ||
| or run on Google Cloud with appropriate service account", |
Copilot
AI
Jan 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The updated error message mixes two different concerns: the subscription not existing and ADC credential configuration. At this point we have already successfully initialized the Pub/Sub client and received a not found for the subscription, so issues with ADC credentials would have failed earlier (e.g. during with_auth() / client creation) instead of reaching this branch. To avoid misleading users who simply have a wrong subscription or project, consider keeping this message focused on the missing subscription (optionally mentioning project ID) and moving ADC guidance to the places where authentication actually fails.
| If not using emulator, ensure Google ADC is configured: \ | |
| set `pubsub.credentials` parameter, or configure GOOGLE_APPLICATION_CREDENTIALS_JSON/GOOGLE_APPLICATION_CREDENTIALS environment variables, \ | |
| or run on Google Cloud with appropriate service account", | |
| Please verify that the subscription name and project ID are correct.", |
| ) FORMAT PLAIN ENCODE JSON; | ||
|
|
||
| statement error credentials must be set if not using the pubsub emulator | ||
| statement error failed to lookup address information|Google Cloud error|Failed to initialize Google Cloud Pub/Sub ADC |
Copilot
AI
Jan 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This SLT expectation now depends on low-level error text from DNS resolution ("failed to lookup address information") and on the exact wording of the Google Cloud ADC initialization error, both of which are owned by external libraries/OS and may change between versions or environments. To keep the test stable, consider matching only on a stable, project-controlled part of the error message (e.g., the generic connector error label or a short context string you add yourself) instead of tying the assertion to the full upstream/OS error phrasing.
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
This PR adds support for Google Application Default Credentials (ADC) to the Google Cloud Pub/Sub connector.
Previously, users were required to explicitly provide the
pubsub.credentialsparameter with a JSON string containing service account credentials. Now, the connector can automatically use Google's ADC when no explicit credentials are provided, improving the developer experience and simplifying configuration.Closes #24646
Usage
When
pubsub.credentialsis not specified, the connector searches for credentials in the following order:GOOGLE_APPLICATION_CREDENTIALS_JSONenvironment variable (JSON content)GOOGLE_APPLICATION_CREDENTIALSenvironment variable (file path)How to test
First, create a Google Cloud Pubsub topic:
Second, create Risingwave table with connector
google_pubsub:Third, publish message into the topic:
Finally, check the result:
Checklist
Documentation
Release note