Skip to content

Race condition causing 422 Unprocessable Entity error #41

Description

@WolfGreyDev

Problem

Sections can contain both .liquid and .json files. The .json files reference the .liquid files as a way to group them together. If a .json file is uploaded before the .liquid file is uploaded, a 422 Unprocessable Entity error is thrown.

Example

header-group.json and header.liquid are both stored in the /sections folder and are uploaded in this order.

header-group.json

header.liquid

{
  "name": "Header Group",
  "type": "header",
  "sections": {
    "header": {
      "type": "header",
      "settings": {
        "color_scheme": "scheme-1"
      }
    }
  },
  "order": [
    "header"
  ]
}
<h1>This is the header</h1>

{% schema %}
{
  "name": "Header",
  "class": "section-header",
  "settings": []
}
Failed Success

The Cause

When uploading a theme, Syncify iterates through the files in alphabetical order (presumably). Because header-group.json is uploaded before header.liquid, the referenced section doesn't exist on the store.

If we were to run the upload argument again, it'll work, since the file is now present from the previous upload job.

Solution

Syncify should iterate through all the .liquid files first, then iterate through the .json files.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions