Skip to content
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

Google::Cloud::InvalidArgumentError: An error has occurred when making a REST request: Invalid JSON payload received. Unknown name "imagelessMode": Cannot find field. #26951

Open
bjreath opened this issue Aug 9, 2024 · 0 comments
Assignees

Comments

@bjreath
Copy link

bjreath commented Aug 9, 2024

Hi, after recently upgrading our gem version from 1.4.0 to 1.4.1, we're seeing an invalid argument error on what looks to be the newly-introduced imageless_mode option when processing a document via Document AI?

Environment details

  • OS: Mac OS
  • Ruby version: 3.3.4
  • Gem name and version: google-cloud-document_ai 1.4.1

Steps to reproduce

See code example below.

Code example

@image = # Ruby attachment
content = @image.download

service = Google::Cloud::DocumentAI.document_processor_service(transport: :rest)
processor_path = service.processor_path(
      project: ENV["PASSPORT_PARSER_PROJECT"],
      location: ENV["PASSPORT_PARSER_REGION"],
      processor: ENV["PASSPORT_PARSER_ID"]
    )
request = Google::Cloud::DocumentAI::V1::ProcessRequest.new(
      skip_human_review: true,
      name: processor_path,
      raw_document: {
        content: content,
        mime_type: @image.content_type
      }
    )
service.process_document(request)

Full backtrace

15:46:36 web.1        | #<Google::Cloud::InvalidArgumentError: An error has occurred when making a REST request: Invalid JSON payload received. Unknown name "imagelessMode": Cannot find field.>
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/google-cloud-document_ai-v1-1.1.0/lib/google/cloud/document_ai/v1/document_processor_service/rest/client.rb:317:in `rescue in process_document'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/google-cloud-document_ai-v1-1.1.0/lib/google/cloud/document_ai/v1/document_processor_service/rest/client.rb:284:in `process_document'
15:46:36 web.1        | /Users/bjreath/Developer/tern/rails/app/services/passport_parser.rb:25:in `call'
15:46:36 web.1        | /Users/bjreath/Developer/tern/rails/app/services/new_application_service.rb:10:in `call'
15:46:36 web.1        | /Users/bjreath/Developer/tern/rails/app/controllers/contacts/passports_controller.rb:85:in `parse'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/abstract_controller/base.rb:224:in `process_action'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_controller/metal/rendering.rb:165:in `process_action'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/abstract_controller/callbacks.rb:259:in `block in process_action'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/activesupport-7.1.3.4/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
15:46:36 web.1        | /Users/bjreath/Developer/tern/rails/app/controllers/concerns/tracking/request.rb:9:in `track_request'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/activesupport-7.1.3.4/lib/active_support/callbacks.rb:130:in `block in run_callbacks'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/turbo-rails-2.0.6/lib/turbo-rails.rb:24:in `with_request_id'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/turbo-rails-2.0.6/app/controllers/concerns/turbo/request_id_tracking.rb:10:in `turbo_tracking_request_id'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/activesupport-7.1.3.4/lib/active_support/callbacks.rb:130:in `block in run_callbacks'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actiontext-7.1.3.4/lib/action_text/rendering.rb:23:in `with_renderer'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actiontext-7.1.3.4/lib/action_text/engine.rb:69:in `block (4 levels) in <class:Engine>'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/activesupport-7.1.3.4/lib/active_support/callbacks.rb:130:in `instance_exec'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/activesupport-7.1.3.4/lib/active_support/callbacks.rb:130:in `block in run_callbacks'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/activesupport-7.1.3.4/lib/active_support/callbacks.rb:141:in `run_callbacks'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/abstract_controller/callbacks.rb:258:in `process_action'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_controller/metal/rescue.rb:25:in `process_action'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_controller/metal/instrumentation.rb:74:in `block in process_action'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/activesupport-7.1.3.4/lib/active_support/notifications.rb:206:in `block in instrument'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/activesupport-7.1.3.4/lib/active_support/notifications/instrumenter.rb:58:in `instrument'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/activesupport-7.1.3.4/lib/active_support/notifications.rb:206:in `instrument'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_controller/metal/instrumentation.rb:73:in `process_action'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_controller/metal/params_wrapper.rb:261:in `process_action'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/activerecord-7.1.3.4/lib/active_record/railties/controller_runtime.rb:32:in `process_action'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/abstract_controller/base.rb:160:in `process'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionview-7.1.3.4/lib/action_view/rendering.rb:40:in `process'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_controller/metal.rb:227:in `dispatch'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_controller/metal.rb:309:in `dispatch'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_dispatch/routing/route_set.rb:32:in `serve'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_dispatch/journey/router.rb:51:in `block in serve'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_dispatch/journey/router.rb:131:in `block in find_routes'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_dispatch/journey/router.rb:124:in `each'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_dispatch/journey/router.rb:124:in `find_routes'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_dispatch/journey/router.rb:32:in `serve'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_dispatch/routing/route_set.rb:882:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/flipper-1.3.0/lib/flipper/middleware/memoizer.rb:87:in `memoized_call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/flipper-1.3.0/lib/flipper/middleware/memoizer.rb:45:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/omniauth-2.1.2/lib/omniauth/strategy.rb:202:in `call!'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/omniauth-2.1.2/lib/omniauth/strategy.rb:169:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/omniauth-2.1.2/lib/omniauth/builder.rb:44:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/rack-3.1.7/lib/rack/tempfile_reaper.rb:20:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/rack-3.1.7/lib/rack/etag.rb:29:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/rack-3.1.7/lib/rack/conditional_get.rb:43:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/rack-3.1.7/lib/rack/head.rb:15:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_dispatch/http/permissions_policy.rb:36:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_dispatch/http/content_security_policy.rb:33:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/rack-session-2.0.0/lib/rack/session/abstract/id.rb:272:in `context'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/rack-session-2.0.0/lib/rack/session/abstract/id.rb:266:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_dispatch/middleware/cookies.rb:689:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/activerecord-7.1.3.4/lib/active_record/migration.rb:655:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/activesupport-7.1.3.4/lib/active_support/callbacks.rb:101:in `run_callbacks'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_dispatch/middleware/callbacks.rb:28:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_dispatch/middleware/executor.rb:14:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_dispatch/middleware/actionable_exceptions.rb:16:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/appsignal-3.12.6/lib/appsignal/rack/abstract_middleware.rb:67:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/bugsnag-6.27.1/lib/bugsnag/integrations/rack.rb:51:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/web-console-4.2.1/lib/web_console/middleware.rb:132:in `call_app'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/web-console-4.2.1/lib/web_console/middleware.rb:28:in `block in call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/web-console-4.2.1/lib/web_console/middleware.rb:17:in `catch'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/web-console-4.2.1/lib/web_console/middleware.rb:17:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/railties-7.1.3.4/lib/rails/rack/logger.rb:37:in `call_app'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/railties-7.1.3.4/lib/rails/rack/logger.rb:24:in `block in call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/activesupport-7.1.3.4/lib/active_support/tagged_logging.rb:135:in `block in tagged'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/activesupport-7.1.3.4/lib/active_support/tagged_logging.rb:39:in `tagged'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/activesupport-7.1.3.4/lib/active_support/tagged_logging.rb:135:in `tagged'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/activesupport-7.1.3.4/lib/active_support/broadcast_logger.rb:240:in `method_missing'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/railties-7.1.3.4/lib/rails/rack/logger.rb:24:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/propshaft-0.8.0/lib/propshaft/quiet_assets.rb:11:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_dispatch/middleware/remote_ip.rb:92:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/request_store-1.6.0/lib/request_store/middleware.rb:19:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_dispatch/middleware/request_id.rb:28:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/rack-3.1.7/lib/rack/method_override.rb:28:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/rack-3.1.7/lib/rack/runtime.rb:24:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_dispatch/middleware/server_timing.rb:59:in `block in call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_dispatch/middleware/server_timing.rb:24:in `collect_events'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_dispatch/middleware/server_timing.rb:58:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_dispatch/middleware/executor.rb:14:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_dispatch/middleware/static.rb:25:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/rack-3.1.7/lib/rack/sendfile.rb:114:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/actionpack-7.1.3.4/lib/action_dispatch/middleware/host_authorization.rb:141:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/rack-3.1.7/lib/rack/events.rb:116:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/railties-7.1.3.4/lib/rails/engine.rb:536:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/puma-6.4.2/lib/puma/configuration.rb:272:in `call'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/puma-6.4.2/lib/puma/request.rb:100:in `block in handle_request'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/puma-6.4.2/lib/puma/thread_pool.rb:378:in `with_force_shutdown'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/puma-6.4.2/lib/puma/request.rb:99:in `handle_request'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/puma-6.4.2/lib/puma/server.rb:464:in `process_client'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/puma-6.4.2/lib/puma/server.rb:245:in `block in run'
15:46:36 web.1        | /Users/bjreath/.rvm/gems/ruby-3.3.4@tern/gems/puma-6.4.2/lib/puma/thread_pool.rb:155:in `block in spawn_thread'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants