lokki54
December 20, 2023, 5:27pm
1
I refer to this doc https://shopify.dev/docs/api/admin-rest/2023-01/resources/asset#put-themes-theme-id-assets
Using API 2023-01 (yes I get a permission from Shopify to use Assets API in 2023-04 etc)
The previous (2 years) code has recently stopped working without any adequate error. Here is my Ruby code
assetA = ShopifyAPI::Asset.all(theme_id: theme_id, asset: { "key" => "templates/collection.liquid" }).first
assetA.value = "{% assign somevar_position = 'posA' %}
{% render 'dotslidersnippet', somevar_position: somevar_position %}
{% section 'static-collection' %}
{% section 'static-recently-viewed' %}
{% section 'static-collection-promo-grid' %}"
assetA.save
The above code get an Exception
{"error_reference":"If you report this error, please include this id: cdab03cc-29cb-41f4-8550-10a4e84e6f0d."} backtrace ["/user/.rvm/gems/ruby-3.2.2/gems/shopify_api-13.3.1/lib/shopify_api/clients/http_client.rb:75:in `request'", "/user/.rvm/gems/ruby-3.2.2/gems/sorbet-runtime-0.5.11156/lib/types/private/methods/call_validation_2_7.rb:108:in `bind_call'", "/user/.rvm/gems/ruby-3.2.2/gems/sorbet-runtime-0.5.11156/lib/types/private/methods/call_validation_2_7.rb:108:in `block in create_validator_method_fast1'", "/user/.rvm/gems/ruby-3.2.2/gems/shopify_api-13.3.1/lib/shopify_api/clients/rest/admin.rb:68:in `put'", "/user/.rvm/gems/ruby-3.2.2/gems/sorbet-runtime-0.5.11156/lib/types/private/methods/call_validation.rb:153:in `bind_call'", "/user/.rvm/gems/ruby-3.2.2/gems/sorbet-runtime-0.5.11156/lib/types/private/methods/call_validation.rb:153:in `validate_call_skip_block_type'", "/user/.rvm/gems/ruby-3.2.2/gems/sorbet-runtime-0.5.11156/lib/types/private/methods/call_validation.rb:95:in `block in create_validator_slow_skip_block_type'", "/user/.rvm/gems/ruby-3.2.2/gems/shopify_api-13.3.1/lib/shopify_api/rest/base.rb:345:in `public_send'", "/user/.rvm/gems/ruby-3.2.2/gems/shopify_api-13.3.1/lib/shopify_api/rest/base.rb:345:in `save'", "/user/.rvm/gems/ruby-3.2.2/gems/sorbet-runtime-0.5.11156/lib/types/private/methods/call_validation.rb:153:in `bind_call'", "/user/.rvm/gems/ruby-3.2.2/gems/sorbet-runtime-0.5.11156/lib/types/private/methods/call_validation.rb:153:in `validate_call_skip_block_type'", "/user/.rvm/gems/ruby-3.2.2/gems/sorbet-runtime-0.5.11156/lib/types/private/methods/call_validation.rb:95:in `block in create_validator_slow_skip_block_type'", "/opt/bitnami/apps/railsapp7/htdocs/shopifydotslider/app/controllers/settings_controller.rb:503:in `block in update'", "/opt/bitnami/apps/railsapp7/htdocs/shopifydotslider/app/controllers/settings_controller.rb:245:in `each'", "/opt/bitnami/apps/railsapp7/htdocs/shopifydotslider/app/controllers/settings_controller.rb:245:in `update'", "/user/.rvm/gems/ruby-3.2.2/gems/actionpack-6.1.7.6/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'", "/user/.rvm/gems/ruby-3.2.2/gems/actionpack-6.1.7.6/lib/abstract_controller/base.rb:228:in `process_action'", "/user/.rvm/gems/ruby-3.2.2/gems/actionpack-6.1.7.6/lib/action_controller/metal/rendering.rb:30:in `process_action'", "/user/.rvm/gems/ruby-3.2.2/gems/actionpack-6.1.7.6/lib/abstract_controller/callbacks.rb:42:in `block in process_action'", "/user/.rvm/gems/ruby-3.2.2/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:117:in `block in run_callbacks'", "/user/.rvm/gems/ruby-3.2.2/gems/actiontext-6.1.7.6/lib/action_text/rendering.rb:20:in `with_renderer'", "/user/.rvm/gems/ruby-3.2.2/gems/actiontext-6.1.7.6/lib/action_text/engine.rb:59:in `block (4 levels) in
How to solve this?
Liam
December 21, 2023, 9:52am
2
Hi Lokki54,
The Asset API has not been deprecated yet, so the upcoming changes should not have caused what you’re seeing. Just to confirm, the above code is not calling the API version 2023-04 or above, correct? Is this happening on multiple stores, or just one?
lokki54
December 21, 2023, 9:59am
3
Hello. Thanks for your reply.
I stay on 2023-01 and was testing things before switching to 2023-04. Yes, it happens on different stores and on two vintage themes. My first thought it was something with shopify_app gem v21.8.1 I recently upgraded and latest Ruby 3.2.2 but error returned from Shopify API give me no glue what is problem. ?
{"error_reference":"If you report this error, please include this id: cdab03cc-29cb-41f4-8550-10a4e84e6f0d."}
Liam
December 21, 2023, 1:14pm
4
I’ve reached out to the Assets API team who’ll be able to look a bit deeper into this. Will update asap.
lokki54
February 27, 2024, 5:51pm
5
Hello. Is any news about this problem?
I have noticed same issue with API 2023-10
here is full debug from my ruby code when I try to edit asset (app has a special permission to write_themes scope)
I follow code from the doc https://shopify.dev/docs/api/admin-rest/2023-10/resources/asset#put-themes-theme-id-assets
ERROR: editasset: {"error_reference":"If you report this error, please include this id: ebaf99d8-5017-4341-97d8-ff2bce751d0e."}
CRITICAL ERROR FULL DEBUG editasset error: {"error_reference":"If you report this error, please include this id: ebaf99d8-5017-4341-97d8-ff2bce751d0e."} backtrace ["/.rvm/gems/ruby-3.2.2/gems/shopify_api-13.3.1/lib/shopify_api/clients/http_client.rb:75:in `request'", "/.rvm/gems/ruby-3.2.2/gems/sorbet-runtime-0.5.11150/lib/types/private/methods/call_validation_2_7.rb:108:in `bind_call'", "/.rvm/gems/ruby-3.2.2/gems/sorbet-runtime-0.5.11150/lib/types/private/methods/call_validation_2_7.rb:108:in `block in create_validator_method_fast1'", "/.rvm/gems/ruby-3.2.2/gems/shopify_api-13.3.1/lib/shopify_api/clients/rest/admin.rb:68:in `put'", "/.rvm/gems/ruby-3.2.2/gems/sorbet-runtime-0.5.11150/lib/types/private/methods/call_validation.rb:153:in `bind_call'", "/.rvm/gems/ruby-3.2.2/gems/sorbet-runtime-0.5.11150/lib/types/private/methods/call_validation.rb:153:in `validate_call_skip_block_type'", "/.rvm/gems/ruby-3.2.2/gems/sorbet-runtime-0.5.11150/lib/types/private/methods/call_validation.rb:95:in `block in create_validator_slow_skip_block_type'", "/.rvm/gems/ruby-3.2.2/gems/shopify_api-13.3.1/lib/shopify_api/rest/base.rb:345:in `public_send'", "/.rvm/gems/ruby-3.2.2/gems/shopify_api-13.3.1/lib/shopify_api/rest/base.rb:345:in `save'", "/.rvm/gems/ruby-3.2.2/gems/sorbet-runtime-0.5.11150/lib/types/private/methods/call_validation.rb:153:in `bind_call'",
"/.rvm/gems/ruby-3.2.2/gems/sorbet-runtime-0.5.11150/lib/types/private/methods/call_validation.rb:153:in `validate_call_skip_block_type'",
"/.rvm/gems/ruby-3.2.2/gems/sorbet-runtime-0.5.11150/lib/types/private/methods/call_validation.rb:95:in `block in create_validator_slow_skip_block_type'",
"/pathtoapp/app/controllers/save_controller.rb:510:in `block in update'", "/pathtoapp/app/controllers/save_controller.rb:258:in `each'",
"/pathtoapp/app/controllers/save_controller.rb:258:in `update'",
"/.rvm/gems/ruby-3.2.2/gems/actionpack-6.1.7.6/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'", "/.rvm/gems/ruby-3.2.2/gems/actionpack-6.1.7.6/lib/abstract_controller/base.rb:228:in `process_action'", "/.rvm/gems/ruby-3.2.2/gems/actionpack-6.1.7.6/lib/action_controller/metal/rendering.rb:30:in `process_action'", "/.rvm/gems/ruby-3.2.2/gems/actionpack-6.1.7.6/lib/abstract_controller/callbacks.rb:42:in `block in process_action'", "/.rvm/gems/ruby-3.2.2/gems/activesupport-6.1.7.6/lib/active_support/callbacks.rb:117:in `block in run_callbacks'", "/.rvm/gems/ruby-3.2.2/gems/actiontext-6.1.7.6/lib/action_text/rendering.rb:20:in `with_renderer'", "/.rvm/gems/ruby-3.2.2/gems/actiontext-6.1.7.6/lib/action_text/engine.rb:59:in `block (4 levels) in