Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

I'm getting lots of ShopifyAPI::Errors::HttpResponseError in my RSpec test suite

I'm getting lots of ShopifyAPI::Errors::HttpResponseError in my RSpec test suite

craftonix
Shopify Partner
11 0 1

Hello!

Here's is one of my errors. It says to report the id so please see the id below: 2eae99f4-192a-4c06-a5ee-fc393743cc7f

 

Failures:

  1) Shopify::Products::AddMetafield creates the metafield
     Failure/Error:
       ShopifyAPI::Metafield.all(
         metafield: {
           owner_id: product.external_id,
           owner_resource: "product"
         }
       )

     ShopifyAPI::Errors::HttpResponseError:
       {"errors":"Not Found","error_reference":"If you report this error, please include this id: 2eae99f4-192a-4c06-a5ee-fc393743cc7f."}

 

and here's my stack trace:

 

     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/shopify_api-13.3.1/lib/shopify_api/clients/http_client.rb:75:in `request'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sorbet-runtime-0.5.11150/lib/types/private/methods/call_validation.rb:256:in `bind_call'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sorbet-runtime-0.5.11150/lib/types/private/methods/call_validation.rb:256:in `validate_call'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sorbet-runtime-0.5.11150/lib/types/private/methods/_methods.rb:275:in `block in _on_method_added'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/shopify_api-13.3.1/lib/shopify_api/clients/rest/admin.rb:36:in `get'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sorbet-runtime-0.5.11150/lib/types/private/methods/call_validation.rb:256:in `bind_call'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sorbet-runtime-0.5.11150/lib/types/private/methods/call_validation.rb:256:in `validate_call'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sorbet-runtime-0.5.11150/lib/types/private/methods/_methods.rb:275:in `block in _on_method_added'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/shopify_api-13.3.1/lib/shopify_api/rest/base.rb:77:in `base_find'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sorbet-runtime-0.5.11150/lib/types/private/methods/call_validation.rb:256:in `bind_call'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sorbet-runtime-0.5.11150/lib/types/private/methods/call_validation.rb:256:in `validate_call'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sorbet-runtime-0.5.11150/lib/types/private/methods/_methods.rb:275:in `block in _on_method_added'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/shopify_api-13.3.1/lib/shopify_api/rest/resources/2023_01/metafield.rb:291:in `all'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sorbet-runtime-0.5.11150/lib/types/private/methods/call_validation.rb:256:in `bind_call'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sorbet-runtime-0.5.11150/lib/types/private/methods/call_validation.rb:256:in `validate_call'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/sorbet-runtime-0.5.11150/lib/types/private/methods/_methods.rb:275:in `block in _on_method_added'
     # ./spec/services/shopify/products/add_metafield_spec.rb:34:in `fetch_metafields'
     # ./spec/services/shopify/products/add_metafield_spec.rb:13:in `block (3 levels) in <top (required)>'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/vcr-6.1.0/lib/vcr/util/variable_args_block_caller.rb:9:in `call_block'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/vcr-6.1.0/lib/vcr.rb:194:in `use_cassette'
     # ./spec/services/shopify/products/add_metafield_spec.rb:11:in `block (2 levels) in <top (required)>'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:263:in `instance_exec'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:263:in `block in run'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:511:in `block in with_around_and_singleton_context_hooks'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:468:in `block in with_around_example_hooks'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:486:in `block in run'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:626:in `block in run_around_example_hooks_for'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-rails-6.0.3/lib/rspec/rails/adapters.rb:75:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/webmock-3.18.1/lib/webmock/rspec.rb:37:in `block (2 levels) in <main>'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:629:in `run_around_example_hooks_for'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:486:in `run'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:468:in `with_around_example_hooks'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:511:in `with_around_and_singleton_context_hooks'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:259:in `run'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:646:in `block in run_examples'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:642:in `map'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:642:in `run_examples'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:607:in `run'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:121:in `block (3 levels) in run_specs'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:121:in `map'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:121:in `block (2 levels) in run_specs'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/configuration.rb:2070:in `with_suite_hooks'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:116:in `block in run_specs'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/reporter.rb:74:in `report'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:115:in `run_specs'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:89:in `run'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:71:in `run'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:45:in `invoke'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.12.2/exe/rspec:4:in `<top (required)>'
     # /Users/alain/.asdf/installs/ruby/3.1.2/bin/rspec:25:in `load'
     # /Users/alain/.asdf/installs/ruby/3.1.2/bin/rspec:25:in `<top (required)>'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.26/lib/bundler/cli/exec.rb:58:in `load'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.26/lib/bundler/cli/exec.rb:58:in `kernel_load'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.26/lib/bundler/cli/exec.rb:23:in `run'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.26/lib/bundler/cli.rb:486:in `exec'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.26/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.26/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.26/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.26/lib/bundler/cli.rb:31:in `dispatch'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.26/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.26/lib/bundler/cli.rb:25:in `start'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.26/exe/bundle:48:in `block in <top (required)>'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.26/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors'
     # /Users/alain/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.26/exe/bundle:36:in `<top (required)>'
     # /Users/alain/.asdf/installs/ruby/3.1.2/bin/bundle:25:in `load'
     # /Users/alain/.asdf/installs/ruby/3.1.2/bin/bundle:25:in `<main>'

Finished in 2.7 seconds (files took 1.84 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/services/shopify/products/add_metafield_spec.rb:10 # Shopify::Products::AddMetafield creates the metafield

 

 

Replies 2 (2)

Liam
Community Manager
3108 344 910

Hi Craftonix,

 

Just to confirm, are you trying to use the metafieldDefinitionCreate mutation?

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

craftonix
Shopify Partner
11 0 1

Hi Liam,

I don't understand your question. You provided a link to GraphQL. So the answer to your question is "No, I am not using that mutation".

 

I am using the ShopifyAPI to fetch and create metafields:

ShopifyAPI::Metafield.all
...

ShopifyAPI::Metafield.new
...

 

However, the error happens at the fetch before I even get to the create, again as you can see from the first code snippet I provided at the beginning of my post which indicates that the error is happening because of this code:

       ShopifyAPI::Metafield.all(
         metafield: {
           owner_id: product.external_id,
           owner_resource: "product"
         }
       )