πŸ‘€ Our most exciting product launch yet πŸš€ Join us May 8th for Sanity Connect

Issue with old schema appearing on production deploys despite correct schema on local development.

22 replies
Last updated: Jun 6, 2022
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 start
for 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
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?
Jun 6, 2022, 4:04 AM
Doing a follow-up deploy to overwrite what's there. The logs complete successfully.
Jun 6, 2022, 4:25 PM
- 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
Can you try running
sanity undeploy
then
sanity deploy
to see if that helps?
Jun 6, 2022, 4:26 PM
Ah, I see now in a thread below you said this is on Vercel. Disregard!
Jun 6, 2022, 4:27 PM
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
The document is updated though because it's reporting unknown fields:
Jun 6, 2022, 4:34 PM
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
dist
folder and running
sanity build
before trying to deploy will unscramble whatever's happening?
Jun 6, 2022, 4:43 PM
Deleting and recreating the entire Vercel project should do the same, right?
Jun 6, 2022, 4:46 PM
But that still shows the old version.
Jun 6, 2022, 4:48 PM
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
Not sure what else I could try other than completely deleting the Sanity project and starting over.
Jun 6, 2022, 4:51 PM
I think I might know what's happening...
Jun 6, 2022, 4:57 PM
I figured it out. πŸ˜…
Jun 6, 2022, 4:57 PM
Super curious what it was, if you don't mind sharing?
Jun 6, 2022, 4:58 PM
What was it πŸ‘€ ?!
Jun 6, 2022, 4:59 PM
I followed the Vercel documentation for deploying Sanity Studio, which included building to the
public
directory: https://vercel.com/guides/deploying-sanity-studio-with-vercel#step-2:-preparing-for-deployment
Jun 6, 2022, 4:59 PM
Which meant I kept
public
in
.gitignore
, but not
dist
, so my
dist
dir was in version control by accident.
Jun 6, 2022, 5:00 PM
The Vercel docs didn't include setting
public
as the output directory so it was serving the default
dist
.
Jun 6, 2022, 5:01 PM
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
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.

Was this answer helpful?