šŸ‘‹ Next.js Conf 2024: Come build, party, run, and connect with us! See all events

Issue with deploying a Gatsby project with Netlify and encountering a "RootQuery.Document was removed" error. The issue was resolved by running certain commands locally.

9 replies
Last updated: Jan 28, 2021
Hi all - deploying a gatsby project with netlify, and for some reason I've gotten build fails on the web project (studio is fine) for the last four tries.
Build log shows:
Found BREAKING changes from previous schema:
2
:11:33 AM: - RootQuery.Document was removed.
We had errors with gatsby/graphql when we tried implementing groups, so rolled that back. I ran
sanity upgrade
and
npm ci
and made very minor styling tweaks. I'm getting that same error if I try to run sanity graphql deploy in my studio, but at least in my dev environmnt everything is working on the web side. I am unsure how to resolve this. I'm not finding any troubleshooting ideas with this particular error.
Jan 28, 2021, 8:17 AM
Hi Janani, could you run the following command in your local studio folder?
DEBUG=sanity* sanity graphql deploy
Also, did this start happening after the studio upgrade?
Jan 28, 2021, 8:36 AM
Hi Janani, could you run the following command in your local studio folder?
DEBUG=sanity* sanity graphql deploy
Also, did this start happening after the studio upgrade?
Jan 28, 2021, 8:36 AM
Thank you for the quick response
user M
, I really appreciate it.
So locally in studio, I re-ran
sanity upgrade
,
npm ci
, and
DEBUG=sanity* sanity graphql deploy
and the output no longer gave me that RootQuery.Document removed error and the output looked fine.
That seems to have done the trick for the web side at least - was able to merge updates into prod and netlify just completed building the web project successfully.

Netlify says studio deployed successfully too. But I checked the studio portal and got this:
Jan 28, 2021, 9:00 AM
Netlify's deploy log gives me no errors when I review the studio side. Also I check my dev env studio and get the same. I see the new Sanity "S" loader and then the same message:
Uncaught error

theme is undefined

Stack:

GlobalStyle<@http://localhost:3333/static/js/app.bundle.js:400321:15
Ne@http://localhost:3333/static/js/app.bundle.js:60662:14864
Ne@http://localhost:3333/static/js/app.bundle.js:60662:14636
He</t.createStyles@http://localhost:3333/static/js/app.bundle.js:60662:23025
He</t.renderStyles@http://localhost:3333/static/js/app.bundle.js:60662:23264
h@http://localhost:3333/static/js/app.bundle.js:60662:24607
l/<@http://localhost:3333/static/js/app.bundle.js:60662:24424
commitHookEffectListMount@http://localhost:3333/static/js/vendor.bundle.js:22452:26
commitLifeCycles@http://localhost:3333/static/js/vendor.bundle.js:22508:34
commitLayoutEffects@http://localhost:3333/static/js/vendor.bundle.js:25524:23
callCallback@http://localhost:3333/static/js/vendor.bundle.js:2909:14
invokeGuardedCallbackDev@http://localhost:3333/static/js/vendor.bundle.js:2958:16
invokeGuardedCallback@http://localhost:3333/static/js/vendor.bundle.js:3013:31
commitRootImpl@http://localhost:3333/static/js/vendor.bundle.js:25262:30
unstable_runWithPriority@http://localhost:3333/static/js/vendor.bundle.js:28479:12
runWithPriority$1@http://localhost:3333/static/js/vendor.bundle.js:13760:10
commitRoot@http://localhost:3333/static/js/vendor.bundle.js:25102:20
finishSyncRender@http://localhost:3333/static/js/vendor.bundle.js:24528:13
performSyncWorkOnRoot@http://localhost:3333/static/js/vendor.bundle.js:24514:23
scheduleUpdateOnFiber@http://localhost:3333/static/js/vendor.bundle.js:23909:28
updateContainer@http://localhost:3333/static/js/vendor.bundle.js:27094:15
legacyRenderSubtreeIntoContainer/<@http://localhost:3333/static/js/vendor.bundle.js:27479:22
unbatchedUpdates@http://localhost:3333/static/js/vendor.bundle.js:24624:12
legacyRenderSubtreeIntoContainer@http://localhost:3333/static/js/vendor.bundle.js:27478:21
render@http://localhost:3333/static/js/vendor.bundle.js:27561:10
render@http://localhost:3333/static/js/app.bundle.js:130192:21
@http://localhost:3333/static/js/app.bundle.js:130195:7
__webpack_require__@http://localhost:3333/static/js/vendor.bundle.js:713:30
fn@http://localhost:3333/static/js/vendor.bundle.js:118:20
@http://localhost:3333/static/js/app.bundle.js:130008:18
__webpack_require__@http://localhost:3333/static/js/vendor.bundle.js:713:30
webpackJsonpCallback@http://localhost:3333/static/js/vendor.bundle.js:26:23
@http://localhost:3333/static/js/app.bundle.js:1:13


(Your browsers Developer Tools may contain more info)

Jan 28, 2021, 9:01 AM
The dashboard users can't get in, but at least the web app deployed? šŸ˜µ
Jan 28, 2021, 9:02 AM
So in posting the two different error messages on the live studio end I see
Uncaught error

t is undefined
and in my dev studio it is

theme is undefined

Jan 28, 2021, 9:17 AM
Glad the above fixed the web front-end at least šŸ˜‰ To deal with this error, could you try removing your
node_modules
folder and
package-lock.json
file in your /studio folder before running
npm install
and trying once more?
Jan 28, 2021, 9:32 AM
it worked! thank you!
Jan 28, 2021, 9:47 AM
Awesome, thanks for confirming!
Jan 28, 2021, 9:55 AM

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?