Website data not appearing in editor after migrating to Slice Machine 1.0

I recently followed this migration documentation to update the Prismic Slice Machine from version 0.1.0 to 1.19.1 as part of upgrading our Next.js Prismic Front End. I seemed to have it working in local for the Next.js side and was doing final testing before deployment. In the slice machine UI all our slices were showing in the slice list and our custom types were also listed (page, menu). When I went into the custom page type I saw that non of the slices were assigned to the page type like they were in the Prismic UI on the web. I assigned the slices to the page type and then pushed the changes to Prismic to confirm everything matched before deploying our FE to production.

At this point all the page data seemed to be deleted from every page in the cms. Our production FE started returned a blank screen and our admin UI displayed no data. See image below. Previously this page had about 10 slices below the slice selector panel.

After trying to figure out what had happened I found the "Open your API endpoint in the web browser to test it in the API browser" link in settings/api & security

On this page we can see that all our data still exists if we use the html response only or if we switch the version in the url from v2 to v1. In which case v1 returns data in the json response for our slices. V2 returns only an empty slices array in the response.

See the image below showing the two versions responses side by side for the same page:

We have contact support multiple times and only received one very basic response 10 hours later, asking us to ensure that our slices are assigned to the custom page type (the exact action that caused the issue)... which they are. No other information or help was provided and we are yet to get another response from them. Our site has now been down for over 24 hours.

Prismic lacks any basic data inport/export functionality or data backup/recovery functionality. Im hoping someone in the community will be able to help. In the meantime we have manually been rebuilding our pages.

The migration documentation seems as if it was written by different people who did not collaborate so information is missing or the author expects detailed knowledge from the reader. It was not a straight forward upgrade.

Thanks

Hi Tom,

Thanks for posting about your experience here. It helps us to understand where users are facing challenges. In this case, this bug should be relatively straightforward to fix.

Basically, Prismic content models are non-destructive. Let's say you have a page type with on property, "title":

  "title": {
    "type": "Text",
    "config": {
      "label": "Title",
      "placeholder": "The page title"
    }
  },

Then, you create and publish document with a title:

{
  title: "The Great Gatsby"
}

After some time, you change the title property on your page type so that it is instead called name:

  "name": {
    "type": "Text",
    "config": {
      "label": "Name",
      "placeholder": "The page title"
    }
  },

When you go to the UI in Prismic, your "The Great Gatsby" document will appear blank. That's because it only has one property, the name property, which is empty. However, the title property still exists in storage. If you change the page type back so that the property is called title, the data will re-appear in the UI.

It seems like, somehow in your migration process, the IDs for your slices (or for your slice zone), got changed, and the content disappeared in the UI. You should be able to compare the IDs for the slice zone and the slices in the API response against the ones in the content models and then realign them.

I believe my colleague has already responded to your support request with a suggestion about how to do this, so I'm going to close this thread.

Thanks,
Sam

Thanks Sam for your reply. Yes we have also heard back from support which was as follows

"The API v2 contains all your previous data that you can see in API v1. One of the updates that we made from v1 to v2 was to exclude data that is no longer part of your custom type schema.
It looks like that’s what’s happening here. It seems that your slice zone has accidentally been renamed from ‘body’ to ‘slices’. If you change this back, all your content should reappear. I don’t think you can do this via the slice machine UI, so you (or your dev) will need to update the model in your code. Once you push that change to Prismic, your content should reappear. Give that a try and let me know if it works."

We did the above and this worked for pages that we had not rebuilt. The slices started showing in the admin UI again. However for the pages we had rebuilt became blank in the admin UI again, so neither the old data nor the new data showed for these pages.

Below is the model.js from our custom type "Page". Please can you confirm if there is anything else that needs changing to make our old data show?

{
  "id": "page",
  "label": "Page",
  "repeatable": true,
  "status": true,
  "format": "custom",
  "json": {
    "Page": {
      "uid": {
        "type": "UID",
        "config": {
          "label": "UID",
          "placeholder": "unique-identifier-eg-homepage"
        }
      },
      "body": {        <----- CHANGED - this from "slices" to "body"
        "type": "Slices",
        "fieldset": "Slice Zone",
        "config": {
          "choices": {
            "text_image": {
              "type": "SharedSlice"
            },
            "image_box": {
              "type": "SharedSlice"
            },
            "hero": {
              "type": "SharedSlice"
            },
            "table": {
              "type": "SharedSlice"
            },
            "video": {
              "type": "SharedSlice"
            },
            "tabs": {
              "type": "SharedSlice"
            },
            "stats": {
              "type": "SharedSlice"
            },
            "title": {
              "type": "SharedSlice"
            },
            "social_carers": {
              "type": "SharedSlice"
            },
            "call_to_action": {
              "type": "SharedSlice"
            },
            "content": {
              "type": "SharedSlice"
            },
            "spacer": {
              "type": "SharedSlice"
            },
            "card": {
              "type": "SharedSlice"
            },
            "interview": {
              "type": "SharedSlice"
            },
            "gallery": {
              "type": "SharedSlice"
            },
            "boxes": {
              "type": "SharedSlice"
            },
            "link": {
              "type": "SharedSlice"
            },
            "activities": {
              "type": "SharedSlice"
            },
            "accordions": {
              "type": "SharedSlice"
            },
            "button_link": {
              "type": "SharedSlice"
            },
            "Carousel": {
              "type": "SharedSlice"
            }
          }
        }
      }
    },
    "SEO Metadata": {
      "meta_title": {
        "type": "Text",
        "config": {
          "label": "Meta Title",
          "placeholder": "My title for Search Engine"
        }
      },
      "meta_description": {
        "type": "Text",
        "config": {
          "label": "Meta Description",
          "placeholder": "The description that will appear in search engine"
        }
      },
      "social_cards": {
        "type": "Group",
        "config": {
          "fields": {
            "social_card_image": {
              "type": "Image",
              "config": {
                "constraint": {},
                "thumbnails": [],
                "label": "Social Card Image"
              }
            },
            "social_card_title": {
              "type": "Text",
              "config": {
                "label": "Social Card Title"
              }
            },
            "social_card_description": {
              "type": "Text",
              "config": {
                "label": "Social card description"
              }
            }
          },
          "label": "Social Cards - Facebook & Twitter"
        }
      }
    }
  }
}

Do you know why upgrading the slice machine version caused this change in naming? Previously this file did not have slices data in it.

Thanks

Hi James,

My colleague tells me that he's helping you getting this sorted out in your support ticket, so I'm going to close this thread.

Sam