Issue with deploying changes in Sanity Cloud resulting in a 502 Bad Gateway error.

5 replies
Last updated: Jul 20, 2023
Hello! Wondering if anyone else is running into this issue. I am using Sanity Cloud and suddenly yesterday I am unable to deploy changes. (Sanity start & the local version of the studio works perfectly still). Thanks in advance!Error is
502 bad gateway -> full error in the comment
Jul 19, 2023, 4:10 PM
sanity deploy
✔ Checking project info
✔ Clearing output folder (20289ms)
✔ Building Sanity (15961ms)
✔ Building index document (34ms)
✔ Minifying JavaScript bundles (73289ms)
✔ Verifying local content
✖ Deploying to Sanity.Studio

Error: POST-request to <https://ribanipd.api.sanity.io/v1/deploy> resulted in HTTP 502 Bad Gateway
    at onResponse (/usr/local/lib/node_modules/@sanity/cli/lib/_chunks/loadEnv-23535f1a.js:1238:13)
    at applyMiddleware (/usr/local/lib/node_modules/@sanity/cli/node_modules/get-it/dist/index.cjs:59:13)
    at onResponse (/usr/local/lib/node_modules/@sanity/cli/node_modules/get-it/dist/index.cjs:105:22)
    at /usr/local/lib/node_modules/@sanity/cli/node_modules/get-it/dist/index.cjs:132:55
    at callback (/usr/local/lib/node_modules/@sanity/cli/node_modules/get-it/dist/index.cjs:487:46)
    at /usr/local/lib/node_modules/@sanity/cli/node_modules/get-it/dist/index.cjs:550:14
    at DestroyableTransform.<anonymous> (/usr/local/lib/node_modules/@sanity/cli/node_modules/get-it/dist/index.cjs:263:13)
    at Object.onceWrapper (node:events:625:28)
    at DestroyableTransform.emit (node:events:523:35)
    at endReadableNT (/usr/local/lib/node_modules/@sanity/cli/node_modules/readable-stream/lib/_stream_readable.js:1010:12)
Jul 19, 2023, 4:12 PM
Maybe try logging out &amp; logging back into the CLI? Do you know what role you have?
Jul 19, 2023, 6:16 PM
thanks
user M
! I tried to log out and log in but the same error still exists (in fact, I don't think I had to log in previously to deploy? this is an inherited github repo so not sure if something was already set up). the user account is administrator.
Jul 19, 2023, 7:37 PM
Just to close this out in case anyone else is having a similar problem. I was able to resolve by building the project separately first
sanity build
and then deploying the studio with minimum options
sanity deploy --no-minify --no-build
Jul 20, 2023, 3:08 PM
Thanks for sharing your solution!
Jul 20, 2023, 6:29 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?