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
This PR fixes an issue where the `Google::Cloud::ErrorReporting` client was completely ignoring the `quota_project` configuration parameter, causing API calls to default billing to the project associated with the credentials. This resulted in `PermissionDeniedError` (Error Reporting API not enabled) for users attempting to report errors to a target project that was different from their credentials project (e.g., issue #25862).
### Changes
* Respect Configuration: Updated `Google::Cloud::ErrorReporting.new` to correctly resolve `quota_project` from the library configuration and pipe it down to the internal `Service` layer.
* Service Wrapper: Updated `Google::Cloud::ErrorReporting::Service` to accept `quota_project` (falling back to credentials) and apply it to the underlying gRPC client configuration.
* Documentation: Added multi-project configuration examples and descriptions to `README.md` and `AUTHENTICATION.md`.
* Testing: Added unit test coverage to confirm configuration propagation and refined YARD doctest mock expectations.
* Modernization: Modernized `Google::Cloud::ErrorReporting::Project#report` to use Ruby 3.2+ anonymous block forwarding (`*args, &`), resolving pre-existing RuboCop style offenses.
* Monorepo Style: Resolved `Lint/SafeNavigationWithEmpty` in top-level `.toys/ci.rb` to ensure modern Ruby CI workflows pass cleanly.
TAG=agy
CONV=8c6d3acb-f6a5-49ce-8263-7c87d2430e6f
Co-authored-by: Yoshi Automation Bot <yoshi-automation@google.com>
The **Project ID** and the path to the **Credentials JSON** file can be configured
99
+
The **Project ID**, **Quota Project**, and the path to the **Credentials JSON** file can be configured
100
100
instead of placing them in environment variables or providing them as arguments.
101
101
102
102
```ruby
103
103
require "google/cloud/error_reporting"
104
104
105
105
Google::Cloud::ErrorReporting.configure do |config|
106
-
config.project_id = "my-project-id"
107
-
config.credentials = "path/to/keyfile.json"
106
+
config.project_id = "my-project-id" # The project where errors are reported
107
+
config.quota_project = "my-billing-project" # The project billed for quota/billing (optional)
108
+
config.credentials = "path/to/keyfile.json"
108
109
end
109
110
110
111
client = Google::Cloud::ErrorReporting.new
111
112
```
112
113
114
+
> [!NOTE]
115
+
> **Project ID** (where errors are sent) and **Quota Project** (which project is billed for the API call) are distinct. By default, the library bills the project associated with the credentials. Use `config.quota_project` if you need to bill a different project.
116
+
113
117
### Cloud SDK
114
118
115
119
This option allows for an easy way to authenticate during development. If
0 commit comments