Skip to content

Updating assets is broken in v13.0.0 #1164

@ClaytonPassmore

Description

@ClaytonPassmore

Issue summary

In v12.5.0, you could update the value of an asset by fetching it, setting a new value, and then saving it:

asset = ShopifyAPI::Asset.all(asset: { key: "layout/theme.liquid" }, theme_id: theme.id).first
asset.value = asset.value + "<p>Something new</p>\n"
asset.save!

In v13.0.0, updating an asset results in a 406 Not Acceptable error.

I'm fairly confident this is broken because of the changes made in #1149. We're no longer sending up the required key parameter (because it hasn't changed).

With access to the asset API being removed in API version 2023-04, I'm not super hopeful that this is actually going to get fixed 🙈

  • shopify_api version: v13.0.0
  • Ruby version: 3.2.2
  • Operating system: Ubuntu 22.04 LTS

Expected behavior

Updating an asset should behave similar to the way it did in v12.5.0 (in that it should work 😄). Including the key when we save the model would fix the problem.

v12.5.0 was obviously sending up more attributes than it should have, but it did work. See the screenshot below. Excuse the large code block - I'm replicating how the gem (incorrectly) determined which attributes changed in v12.5.0.

Screenshot 2023-05-25 at 3 10 58 PM

Actual behavior

In v13.0.0, updating an asset results in a 406 Not Acceptable error. Note that I'm using the new private methods introduced in #1149 for determining the changed attributes.

Screenshot 2023-05-25 at 3 28 18 PM

Steps to reproduce the problem

  1. Fetch an asset
  2. Change the asset's value
  3. Try to save the asset

Metadata

Metadata

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