Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Upgrading to Sanity v3 causing ECONNRESET error, resolved by updating Node version

10 replies
Last updated: May 23, 2023
Hey everyone, I’m wondering if anyone would be willing to help an up-and-coming dev?
I’ve been going through my projects and upgrading them to v3 from v2 (excellent docs to migrate btw!). Two projects I’m getting the same error after I build and deploy, when I use
sanity graphql deploy
I return
Error: read ECONNRESET
.
I have tried to remove my
node_modules
folder and
package-lock.json
file then
npm install
and I’ve removed my
.sanity
and
dist
folders then run the
sanity deploy
again. No change. I’ve researched this error but can’t find anything from Sanity builds - some regarding Postman, some regarding Apple errors. Nothing helpful. VS Code hasnt provided any linkage for this error so I’m a bit lost as to how to resolve it.
Anyone have any ideas of where I can look for answers?
May 17, 2023, 7:37 PM
What version of the Studio/CLI are you running?
May 17, 2023, 7:49 PM
sanity v3.11.1sanity/cli v3.10.1
May 17, 2023, 8:20 PM
Looks like sanity dataset import [file] production is resulting in the same error 🤔
May 17, 2023, 10:02 PM
I just had another project start this same error after I deleted some schemas that were no longer needed. This might be the key to the problem, but I’m not sure on the fix yet.
May 19, 2023, 7:18 PM
We shipped a fix yesterday that addressed a different issue with the graphql deploy command. In both projects that gave you this error, was it only after making changes that it happened or have you never been able to deploy?
May 19, 2023, 8:06 PM
It’s always been after changes, specifically the removal of one or more schema files.
May 19, 2023, 8:15 PM
I just updated sanity and the sanity/cli and I have a new error:
 Generating GraphQL API: production/default/usr/local/lib/node_modules/@sanity/cli/lib/_chunks/loadEnv-34f1f160.js:1179
  const isQuery = options.uri.startsWith("/data/query");
                              ^

TypeError: Cannot read properties of undefined (reading 'startsWith')
    at shouldRetry (/usr/local/lib/node_modules/@sanity/cli/lib/_chunks/loadEnv-34f1f160.js:1179:31)
    at onError (/usr/local/lib/node_modules/@sanity/cli/node_modules/get-it/dist/middleware.cjs:447:12)
    at applyMiddleware (/usr/local/lib/node_modules/@sanity/cli/node_modules/get-it/dist/index.cjs:60:15)
    at onResponse (/usr/local/lib/node_modules/@sanity/cli/node_modules/get-it/dist/index.cjs:139:24)
    at /usr/local/lib/node_modules/@sanity/cli/node_modules/get-it/dist/index.cjs:115:55
    at ClientRequest.callback (/usr/local/lib/node_modules/@sanity/cli/node_modules/get-it/dist/index.cjs:423:46)
    at Object.onceWrapper (node:events:510:26)
    at ClientRequest.emit (node:events:402:35)
    at TLSSocket.socketErrorListener (node:_http_client:447:9)
    at TLSSocket.emit (node:events:390:28)
May 19, 2023, 8:22 PM
Ok I’m back to working on this issue again today.
sanity
and
sanity/cli
have just updated to 3.11.1,
sanity deploy
works, but
sanity graphql deploy
results in this error:
.nvm/versions/node/v18.6.0/lib/node_modules/@sanity/cli/lib/_chunks/loadEnv-34f1f160.js:1179
  const isQuery = options.uri.startsWith("/data/query");
                              ^

TypeError: Cannot read properties of undefined (reading 'startsWith')
    at shouldRetry (/Users/ericphifer/.nvm/versions/node/v18.6.0/lib/node_modules/@sanity/cli/lib/_chunks/loadEnv-34f1f160.js:1179:31)
    at onError (/Users/ericphifer/.nvm/versions/node/v18.6.0/lib/node_modules/@sanity/cli/node_modules/get-it/dist/middleware.cjs:447:12)
    at applyMiddleware (/Users/ericphifer/.nvm/versions/node/v18.6.0/lib/node_modules/@sanity/cli/node_modules/get-it/dist/index.cjs:60:15)
    at onResponse (/Users/ericphifer/.nvm/versions/node/v18.6.0/lib/node_modules/@sanity/cli/node_modules/get-it/dist/index.cjs:139:24)
    at /Users/ericphifer/.nvm/versions/node/v18.6.0/lib/node_modules/@sanity/cli/node_modules/get-it/dist/index.cjs:115:55
    at ClientRequest.callback (/Users/ericphifer/.nvm/versions/node/v18.6.0/lib/node_modules/@sanity/cli/node_modules/get-it/dist/index.cjs:423:46)
    at Object.onceWrapper (node:events:628:26)
    at ClientRequest.emit (node:events:525:35)
    at TLSSocket.socketErrorListener (node:_http_client:481:9)
    at TLSSocket.emit (node:events:513:28)

Node.js v18.6.0
If anyone has any leads on a fix, I’d be much obliged.
🙂
May 23, 2023, 5:27 PM
Simple solution: updated to node 18.16.0 and solved the issue. Thanks to
user M
for looking into the issue!
May 23, 2023, 5:32 PM
Somehow I always forget to check about updating Node 😅
Glad you got it sorted out!
May 23, 2023, 5:59 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?