Issue with old schema appearing on production deploys despite correct schema on local development.
22 replies
Last updated: Jun 6, 2022
S
I'm not sure why, but I'm seeing an old schema on a production deploys even though I see the right schema on
sanity startfor local development... never encountered this issue before. Not sure where to start with debugging? Any help is appreciated. Thanks. š
Jun 6, 2022, 2:39 AM
V
Out of curiosity, are you undeploying and then redeploying in place to the same URL?
Or just doing a follow-up deploy to overwrite what's there?
Does Vercel show anything goofy in the logs that might hint at why it's not taking it up?
Or just doing a follow-up deploy to overwrite what's there?
Does Vercel show anything goofy in the logs that might hint at why it's not taking it up?
Jun 6, 2022, 4:04 AM
S
Doing a follow-up deploy to overwrite what's there. The logs complete successfully.
Jun 6, 2022, 4:25 PM
S
- Clearing output folder ā Clearing output folder (4ms) - Building Sanity ā Building Sanity (13115ms) - Building index document ā Building index document (26ms) - Minifying JavaScript bundles ā Minifying JavaScript bundles (24863ms) Done in 39.72s.
Jun 6, 2022, 4:26 PM
S
Yeah. This is bizarre. I even completely destroyed the Vercel project and created a new one, but it's still showing the old schema.
Jun 6, 2022, 4:33 PM
S
The document is updated though because it's reporting unknown fields:
Jun 6, 2022, 4:34 PM
V
If the schema definition changes are recognized enough to report missing fields, what's the most noticeable difference that's left that doesn't mirror the local version? Are there console log errors while using the two different studios that differ from each other?
Jun 6, 2022, 4:43 PM
I wonder if deleting the
distfolder and running
sanity buildbefore trying to deploy will unscramble whatever's happening?
Jun 6, 2022, 4:43 PM
S
Deleting and recreating the entire Vercel project should do the same, right?
Jun 6, 2022, 4:46 PM
S
But that still shows the old version.
Jun 6, 2022, 4:48 PM
S
I only see one console log message, but it happens for:
Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.
Jun 6, 2022, 4:50 PM
S
Not sure what else I could try other than completely deleting the Sanity project and starting over.
Jun 6, 2022, 4:51 PM
S
I think I might know what's happening...
Jun 6, 2022, 4:57 PM
S
I figured it out. š
Jun 6, 2022, 4:57 PM
V
Super curious what it was, if you don't mind sharing?
Jun 6, 2022, 4:58 PM
S
I followed the Vercel documentation for deploying Sanity Studio, which included building to the
publicdirectory: https://vercel.com/guides/deploying-sanity-studio-with-vercel#step-2:-preparing-for-deployment
Jun 6, 2022, 4:59 PM
S
Which meant I kept
publicin
.gitignore, but not
dist, so my
distdir was in version control by accident.
Jun 6, 2022, 5:00 PM
S
The Vercel docs didn't include setting
publicas the output directory so it was serving the default
dist.
Jun 6, 2022, 5:01 PM
V
Aaaah that makes sense. I have done Next.js sites on there where using the default dev and build settings and paths almost never work....I have a totally separate build folder in my config just so I don't step on own my toes with local testing so I wound up using that separate one anyway whenever I go live.
Jun 6, 2022, 5:11 PM
S
Yeah. We should probably recommend that the Vercel docs be updated to use the default build directory.
Jun 6, 2022, 5:12 PM
Sanityā build remarkable experiences at scale
Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.