googleapis / googleapis/google-api-ruby-client

Search Index get_url_notification_metadata throws ClientError: notFound

Open
#23,176 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
2.9k
Forks
888
Avg merge
6m
Merged PRs (30d)
218

Description

I am trying to use the search indexing api. I got it all setup and can see in the google api metrics page that i was authenticated and send the correct requests. The Problem is even if i update an url and get an 200 i get an error when i try to retrive the informations via get_url_notification_metadata. I dont now if i am doing something wrong, because i havent used this api yet or if there is a bug.

#### Environment details

- OS: MacOS 15.4.1 (24E263)
- Ruby version: ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
- Gem name and version: google-api-client (0.53.0)
- Partial gem lock:
```
google-api-client (0.53.0)
google-apis-core (~> 0.1)
google-apis-generator (~> 0.1)
google-apis-core (0.17.0)
addressable (~> 2.5, >= 2.5.1)
googleauth (~> 1.9)
httpclient (>= 2.8.3, < 3.a)
mini_mime (~> 1.0)
mutex_m
representable (~> 3.0)
retriable (>= 2.0, < 4.a)
google-apis-discovery_v1 (0.20.0)
google-apis-core (>= 0.15.0, < 2.a)
google-apis-generator (0.17.0)
activesupport (>= 5.0)
gems (~> 1.2)
google-apis-core (>= 0.15.0, < 2.a)
google-apis-discovery_v1 (~> 0.18)
thor (>= 0.20, < 2.a)
google-cloud-env (2.3.0)
base64 (~> 0.2)
faraday (>= 1.0, < 3.a)
google-logging-utils (0.2.0)
googleauth (1.14.0)
faraday (>= 1.0, < 3.a)
google-cloud-env (~> 2.2)
google-logging-utils (~> 0.1)
jwt (>= 1.4, < 3.0)
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (>= 0.16, < 2.a)
```

#### Steps to reproduce

1. Use the code below
2. Change url to where you have access
3. run

#### Code example

```ruby
require 'google/apis/indexing_v3'
require 'googleauth'

scope = 'https://www.googleapis.com/auth/indexing'
index_service = Google::Apis::IndexingV3::IndexingService.new
index_service.authorization = Google::Auth::ServiceAccountCredentials.make_creds(json_key_io: File.open('app/controllers/content-api-key.json'),
scope: scope)
index_service.authorization.fetch_access_token!
url = "https://audiobookdb.net/audiobooks/x2Af9YPJ"
update_request_parameter = Google::Apis::IndexingV3::UrlNotification.new(url: url, type: "URL_UPDATED")
index_service.publish_url_notification(update_request_parameter)

begin
index_service.get_url_notification_metadata(url: url)
rescue
end
```

#### Log
```
Sending HTTP post https://indexing.googleapis.com/v3/urlNotifications:publish?
200
#, @http_header=#, @body_size=0, @body_type=nil, @chunked=false, @dumped=false, @header_item=[["Content-Type", "application/json; charset=UTF-8"], ["Vary", "Origin"], ["Vary", "X-Origin"], ["Vary", "Referer"], ["Content-Encoding", "gzip"], ["Date", "Wed, 21 May 2025 07:45:04 GMT"], ["Server", "ESF"], ["X-XSS-Protection", "0"], ["X-Frame-Options", "SAMEORIGIN"], ["X-Content-Type-Options", "nosniff"], ["Alt-Svc", "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000"], ["Transfer-Encoding", "chunked"]], @http_version="1.1", @is_request=false, @reason_phrase="OK", @request_absolute_uri=nil, @request_method="POST", @request_query=nil, @request_uri=#, @status_code=200>, @peer_cert=#, issuer=#, serial=#, not_before=2025-04-21 08:41:49 UTC, not_after=2025-07-14 08:41:48 UTC>, @previous=nil>
Success - #>

Sending HTTP get https://indexing.googleapis.com/v3/urlNotifications/metadata?url=https%3A%2F%2Faudiobookdb.net%2Faudiobooks%2Fx2Af9YPJ
404
#, @http_header=#, @body_size=0, @body_type=nil, @chunked=false, @dumped=false, @header_item=[["Vary", "Origin"], ["Vary", "X-Origin"], ["Vary", "Referer"], ["Content-Type", "application/json; charset=UTF-8"], ["Content-Encoding", "gzip"], ["Date", "Wed, 21 May 2025 07:45:04 GMT"], ["Server", "ESF"], ["X-XSS-Protection", "0"], ["X-Frame-Options", "SAMEORIGIN"], ["X-Content-Type-Options", "nosniff"], ["Alt-Svc", "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000"], ["Transfer-Encoding", "chunked"]], @http_version="1.1", @is_request=false, @reason_phrase="Not Found", @request_absolute_uri=nil, @request_method="GET", @request_query=nil, @request_uri=#, @status_code=404>, @peer_cert=#, issuer=#, serial=#, not_before=2025-04-21 08:41:49 UTC, not_after=2025-07-14 08:41:48 UTC>, @previous=nil>
Caught error notFound: Requested entity was not found.
Error - #, @request_query=nil, @request_absolute_uri=nil, @status_code=404, @reason_phrase="Not Found", @body_type=nil, @body_charset=nil, @body_date=nil, @body_encoding=#, @is_request=false, @header_item=[["Vary", "Origin"], ["Vary", "X-Origin"], ["Vary", "Referer"], ["Content-Type", "application/json; charset=UTF-8"], ["Content-Encoding", "gzip"], ["Date", "Wed, 21 May 2025 07:45:04 GMT"], ["Server", "ESF"], ["X-XSS-Protection", "0"], ["X-Frame-Options", "SAMEORIGIN"], ["X-Content-Type-Options", "nosniff"], ["Alt-Svc", "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000"], ["Transfer-Encoding", "chunked"]], @dumped=false> body: "{\n \"error\": {\n \"code\": 404,\n \"message\": \"Requested entity was not found.\",\n \"errors\": [\n {\n \"message\": \"Requested entity was not found.\",\n \"domain\": \"global\",\n \"reason\": \"notFound\"\n }\n ],\n \"status\": \"NOT_FOUND\"\n }\n}\n">
```

#### Api Metric

Image

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.