Skip to content

Search Index get_url_notification_metadata throws ClientError: notFound #23176

@lars-hoeck

Description

@lars-hoeck

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

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::Message:0x0000000133e781d0 @http_body=#<HTTP::Message::Body:0x0000000133e78180 @body="{\n" + "  \"urlNotificationMetadata\": {\n" + "    \"url\": \"https://audiobookdb.net/audiobooks/x2Af9YPJ\"\n" + "  }\n" + "}\n", @chunk_size=nil, @positions=nil, @size=0>, @http_header=#<HTTP::Message::Headers:0x000000013255b378 @body_charset=nil, @body_date=nil, @body_encoding=#<Encoding:UTF-8>, @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=#<Addressable::URI:0x6eeb0 URI:https://indexing.googleapis.com/v3/urlNotifications:publish?>, @status_code=200>, @peer_cert=#<OpenSSL::X509::Certificate subject=#<OpenSSL::X509::Name CN=upload.video.google.com>, issuer=#<OpenSSL::X509::Name CN=WR2,O=Google Trust Services,C=US>, serial=#<OpenSSL::BN 269188937281416482999652193496082308393>, not_before=2025-04-21 08:41:49 UTC, not_after=2025-07-14 08:41:48 UTC>, @previous=nil>
Success - #<Google::Apis::IndexingV3::PublishUrlNotificationResponse:0x0000000132217478
 @url_notification_metadata=
  #<Google::Apis::IndexingV3::UrlNotificationMetadata:0x0000000132217040
   @url="https://audiobookdb.net/audiobooks/x2Af9YPJ">>

Sending HTTP get https://indexing.googleapis.com/v3/urlNotifications/metadata?url=https%3A%2F%2Faudiobookdb.net%2Faudiobooks%2Fx2Af9YPJ
404
#<HTTP::Message:0x0000000133cbcee0 @http_body=#<HTTP::Message::Body:0x0000000133cbce90 @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", @chunk_size=nil, @positions=nil, @size=0>, @http_header=#<HTTP::Message::Headers:0x00000001324ff0a0 @body_charset=nil, @body_date=nil, @body_encoding=#<Encoding:UTF-8>, @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=#<Addressable::URI:0x6eec4 URI:https://indexing.googleapis.com/v3/urlNotifications/metadata?url=https%3A%2F%2Faudiobookdb.net%2Faudiobooks%2Fx2Af9YPJ>, @status_code=404>, @peer_cert=#<OpenSSL::X509::Certificate subject=#<OpenSSL::X509::Name CN=upload.video.google.com>, issuer=#<OpenSSL::X509::Name CN=WR2,O=Google Trust Services,C=US>, serial=#<OpenSSL::BN 269188937281416482999652193496082308393>, 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 - #<Google::Apis::ClientError: notFound: Requested entity was not found. status_code: 404 header: #<HTTP::Message::Headers:0x00000001324bc638 @http_version="1.1", @body_size=0, @chunked=false, @request_method="GET", @request_uri=#<Addressable::URI:0x6eec4 URI:https://indexing.googleapis.com/v3/urlNotifications/metadata?url=https%3A%2F%2Faudiobookdb.net%2Faudiobooks%2Fx2Af9YPJ>, @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=#<Encoding:UTF-8>, @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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions