Watch a live product demo 👀 See how Sanity powers richer commerce experiences

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

The Sanity Composable Content Cloud is the 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.

Categorized in

Related answers

Get more help in the community Slack

TopicCategoriesFeaturedRepliesLast Updated
After adding the subtitle and running this code npm run graphql-deploy It does nothingSep 15, 2020
how to limit a reference to just one entry in Studio reference input side versus the default as-many-entries-as-you-fill-in-an-array...Sep 18, 2020
Is it possible to fetch more than one "_type" using GROQ?Nov 2, 2020
I want to add a view with the Structure builder (S.view.component) where I list similar documents based on the title. What...Sep 23, 2020
Is there a structure builder example where the format of each preview for the document list is modified?Feb 3, 2021
I have an array of references to a country schema type but it always just returns NULL values for meJan 30, 2021
Hi, I need help with a query for getting the url of an image asset. Here is what I've been trying, but I only get the _ref...Dec 1, 2020
Sanity UI looks brilliant :smiley: Is something like the current date picker possible at the moment? I’m not sure if anicon...Dec 21, 2020
Hey everyone. I have been coding and may have potentially accidentally deleted something. Does anyone know how to resolve...Dec 26, 2020
Hello everyone and happy new year :raised_hands::skin-tone-2:, I have a problem with outputting Portable Text :disappointed:...Jan 1, 2021

Related contributions

Clean Next.js + Sanity app
- Template

Official(made by Sanity team)

A clean example of Next.js with embedded Sanity ready for recomposition.

Cody Olsen
Go to Clean Next.js + Sanity app

Blog with Built-in Content Editing
- Template

Official(made by Sanity team)

A Sanity-powered blog with built-in content editing and instant previews.

Go to Blog with Built-in Content Editing