Themekit: including new section/block files when running `theme replace` throws error

Created on 11 Aug 2016  Â·  12Comments  Â·  Source: Shopify/themekit

When working with our new sections model, we're getting the following error when trying to deploy changes to a theme using a full replace:

[09:20:46] Could not upload config/settings_data.json:
Invalid type value for block 'placeholder'. Type must be defined in schema
Invalid type value for block 'linklist'. Type must be defined in schema
Invalid type value for block 'social'. Type must be defined in schema

The theory is that settings_data.json is being uploaded to the server before the blocks that are referenced therein. Since the files being referenced don't exist on the server yet, it throws an error.

In order to fix this, I think we need to ensure the contents of the config directory are uploaded last.

Also, @Thibaut has suggested we probably want to upload settings_schema.json before settings_data.json for similar reasons.

@chrisbutcher

Most helpful comment

Also haven't seen this happen in the last few versions. I'm happy to close this until it chooses to reappear.

All 12 comments

@m-ux Can you confirm that the ordering of what is uploaded is the problem? i.e. can you do you individual file/folder uploads to test the scenario of sending for example settings_data.json last?

so @cshold has done what you've suggested indirectly by uploading content via watch task vs full deploy.

We can go through a more direct test tomorrow though to confirm (will update shortly).

On v0.4.7 this does not seem to be an issue any further when running theme replace. Can anyone else confirm?

Also haven't seen this happen in the last few versions. I'm happy to close this until it chooses to reappear.

@karocena just ran into this issue again so it is still prevalent.

Could not upload config/settings_data.json:

Invalid type value for block 'slideshow-0'. Type must be defined in schema
Invalid type value for block 'slideshow-1'. Type must be defined in schema
Preset 'Default' Invalid type value for block 'slideshow-0'. Type must be defined in schema
Preset 'Default' Invalid type value for block 'slideshow-1'. Type must be defined in schema

Would this be helped if theme upload and theme replace were deterministic? i.e. They uploaded files in a specific order like the theme gem would (assets/, config/, snippets/, etc.).

@cshold what version of themekit is @karocena running on? Is this happening in watch/upload/replace?

I'm using v0.4.7 (I think this might be outdated).

In this specific instance, I used slate deploy, which I believe uses theme replace

Thanks @karocena and that is the most current version.

This just popped up again:

Asset Perform Update to config/settings_data.json at host <je-dev-store.myshopify.com>
    Status text: Unprocessable Entity
    Errors: Invalid type value for block 'collection-list-0'. Type must be defined in schema
        Invalid type value for block 'collection-list-1'. Type must be defined in schema
        Invalid type value for block 'collection-list-2'. Type must be defined in schema
        Preset 'Default' Invalid type value for block 'collection-list-0'. Type must be defined in schema
        Preset 'Default' Invalid type value for block 'collection-list-1'. Type must be defined in schema
        Preset 'Default' Invalid type value for block 'collection-list-2'. Type must be defined in schema

I think the fix would be to upload the /config folder (and ideally settings_data.json after settings_schema.json) after everything else, as the info in settings_data.json is reliant on the schema in each section file existing.

@cshold I am still trying to figure out how to handle this because I cannot come up with an easy way of adding precedence to these items. For instance do I always upload the schema before the data even if the schema has not changed?

This happens mostly with update or replace right? I assume that it wouldn't happen with watch since you would edit your schema first.

I haven't seen it happen with watch — it only seems to happen when moving to a new theme (aka replacing one) via replace or upload. I don't think you'd have to consider this for watch but not overly confident with that.

Was this page helpful?
0 / 5 - 0 ratings