😎 Discover cool tips and tricks for customization in our next Developer Deep Dive virtual event - sign up now!

Nuxt ServerError: An invalid response was received from the upstream server

26 replies
Last updated: Sep 15, 2020
I’m receiving this error message when trying to generate my Nuxt app – nothing has changed in this repo and no such problems are being experieced with Sanity projects on this account.

   │   ✖ Nuxt Fatal Error                                                                                                                                  
   │   ServerError: An invalid response was received from the upstream server                                                                     
The culprit appears to be the Sanity Client but nothing has changed in this repo in 18 days and previously all deployments were working fine. Reinstalling node_modules hasn’t fixed the problem – and regardless it occurs both on Netlify and locally, despite no new changes to the repo and the last deployment triggered by Sanity Studio working perfectly.
Sep 14, 2020, 3:51 PM
I'm getting the same, since an hour or so ago
Sep 14, 2020, 3:58 PM
ah OK! amazing (in that its not just me…) –
user B
do you use Nuxt or different stack too?
Sep 14, 2020, 4:03 PM
Different stack, this is from a Node cloud function in AWS using the Sanity client library
Sep 14, 2020, 4:05 PM
Knut Melvær
Are you aware of this?
Sep 14, 2020, 4:05 PM
It’s a bit hard to tell without more debugging info? Can you get hold of the networking requests?
Sep 14, 2020, 4:35 PM
Knut Melvær
Not really, as these were all occurring in cloud functions via Netlify for me. I can give timestamps, but that's about all.
The error was generated for me by fetch requests using the Sanity JS client (v0.147.3) with the following code as an example that triggered it (intermittently).

const result = await client.fetch(query, { id, since })
    .catch((error) => {
      console.error('Request failed:', error.message)
    })
This would log the error message

Request failed: An invalid response was received from the upstream server
One such request was to project
fgxigzm8
at
2020-09-14T15:20:19.080Z
Sep 14, 2020, 4:49 PM
It looks like the error was probably sent by a proxy server at Sanity's end, that's what the message (and Google) would seem to suggest.
Sep 14, 2020, 4:54 PM
Hi Simon and Chris, we’ll start looking into this. Thanks for the detailed reporting. Just found the same error in our logs for your project.
Let’s see if we can figure out where this is coming from
🕵️‍♀️
Sep 14, 2020, 4:59 PM
Great, thanks 🙂
Sep 14, 2020, 5:00 PM
Thanks
user M
! Here’s an error log from one of mine – projectId:
45bzdam9

An invalid response was received from the upstream server          17:01:55 UTC

  at onResponse (node_modules/@sanity/client/lib/http/request.js:19:13)
  at node_modules/@sanity/client/node_modules/get-it/lib-node/util/middlewareReducer.js:10:22
  at Array.reduce (<anonymous>)
  at applyMiddleware (node_modules/@sanity/client/node_modules/get-it/lib-node/util/middlewareReducer.js:9:29)
  at onResponse (node_modules/@sanity/client/node_modules/get-it/lib-node/index.js:81:22)
  at node_modules/@sanity/client/node_modules/get-it/lib-node/index.js:48:55

Sep 14, 2020, 5:09 PM
Thanks
user M
! Here’s an error log from one of mine – projectId:
45bzdam9

An invalid response was received from the upstream server          17:01:55 UTC

  at onResponse (node_modules/@sanity/client/lib/http/request.js:19:13)
  at node_modules/@sanity/client/node_modules/get-it/lib-node/util/middlewareReducer.js:10:22
  at Array.reduce (<anonymous>)
  at applyMiddleware (node_modules/@sanity/client/node_modules/get-it/lib-node/util/middlewareReducer.js:9:29)
  at onResponse (node_modules/@sanity/client/node_modules/get-it/lib-node/index.js:81:22)
  at node_modules/@sanity/client/node_modules/get-it/lib-node/index.js:48:55

Sep 14, 2020, 5:09 PM
Thanks Simon! Are you consistently getting these errors or is it hit and miss when trying to generate the Nuxt app?
Sep 14, 2020, 5:17 PM
I’m not sure if it’s all documents (sorry!), it seems like it isn’t if every single one is definitely being logged – but it’s a very large number, of all types, which causes the build to fail
Sep 14, 2020, 6:15 PM
Looks like it was a temporary hiccup around the times you reported the server errors. Things should be back to functioning properly for a while already, but please let me know if this is not the case for any of your projects.
Sep 14, 2020, 9:22 PM
Yep, everything back to normal now, thanks. It was day 6 of a big client project being live in production, having sung the praises of Sanity to them throughout the build, so it was a bit frustrating it started getting errors and have to explain to the client after handling a lot of traffic well over the weekend for us.
Thank you for responding so quickly and investigating, we all know problems happen in tech sometimes, and it's the customer service that counts when they do. It was great that you
user M
and
Knut Melvær
got onto this so quickly.
Sep 15, 2020, 8:20 AM
Hi Chris, glad things have gone back to normal. I’m sorry this happened right after launching a large project - definitely frustrating after all the hard work you put in. Thanks for bearing with us. And thank you for singing those praises 🙌 We’ll do our best to avoid future hiccups like this one.
Sep 15, 2020, 8:35 AM
user M
I'm afraid I spoke too soon. It happened again
2020-09-15T09:10:51.060Z
Sep 15, 2020, 9:15 AM
Looks like we did - very sorry about this. I’ll ping the operations team and we’ll start looking into this.
Sep 15, 2020, 9:18 AM
Thanks 🙂
Sep 15, 2020, 9:18 AM
Sep 15, 2020, 9:37 AM
Things should be much better since around 10 minutes ago
Sep 15, 2020, 9:56 AM
Yes, no more errors in our logs. I'll keep an eye on it all, but hopefully sorted now. Thanks
Sep 15, 2020, 9:59 AM
20 seconds after I replied, in a different project
ko2r7n3e
via the CDN we hit a similar error!
2020-09-15T09:59:58.237Z
we got a 502 Bad Gateway.
Sep 15, 2020, 10:14 AM
Was that a single occurrence is it still happening? Things seem stable from what I can see but it might be project-specific in this case.
Sep 15, 2020, 11:03 AM
We had the CDN one it just twice, 10 seconds apart, so it could have just been a blip. Certainly much fewer cases of error occurring. Now onto the fact Netlify is down, which you probably can't help me with!
Sep 15, 2020, 11:16 AM
Sorry to hear. Heavy weather all around it seems, but it looks like they’re implementing a fix: https://www.netlifystatus.com/
Sep 15, 2020, 11:19 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?