👀 Our most exciting product launch yet 🚀 Join us May 8th for Sanity Connect

Discussion on deploying Sanity Studio to Google App Engine

25 replies
Last updated: May 4, 2021
Anyone know where I can find a tutorial or even just an example app.yaml for deploying sanity studio to google app engine?
May 4, 2021, 6:27 PM
The closest I could find was the example discussed here for an App Engine deployment. Apologies if it’s not relevant but hopefully it can provide a starting point.
May 4, 2021, 6:58 PM
I think I’m stuck on the part where I need to add a CORS origin. I tried following this and added the domain of our running service, but I’m only seeing
Connecting to <http://Sanity.io|Sanity.io>
loading forever.
May 4, 2021, 7:00 PM
Do you happen to get any errors or warnings in the browser?
May 4, 2021, 7:05 PM
i get 500s for the css and js bundles
May 4, 2021, 7:06 PM
for the first get on the domain i get
304
May 4, 2021, 7:06 PM
And in headers it says
*Referrer Policy:* strict-origin-when-cross-origin
May 4, 2021, 7:07 PM
Okay, thank you. I’ve requested help from up the chain.
May 4, 2021, 7:10 PM
oh i think i see the issue. in app engine logs there’s
sh: 1: exec: sanity: not found
May 4, 2021, 7:14 PM
i bet it’s not installing sanity cli the way it needs to in order to run
sanity start
May 4, 2021, 7:14 PM
i need to try hosting just the static dist files, not building up in the cloud. i think i can take a shot at this
May 4, 2021, 7:15 PM
Ahh, good find. I saw a case yesterday that needed
@sanity/cli
installed as a dev dependency and bet that's the case here too.
May 4, 2021, 7:15 PM
Or that too.
May 4, 2021, 7:15 PM
This is just hosting the built static files on app engine, so no server at all. I guess cost wise it would be cheaper to just upload them to a bucket 😅
May 4, 2021, 7:17 PM
user P
I have nodejs as my runtime; should I change that to python?
May 4, 2021, 7:17 PM
sec, need to read up on the nodejs runtime on gcp. All you need is the static hosting option
May 4, 2021, 7:17 PM
https://cloud.google.com/appengine/docs/standard/nodejs/config/appref looks like you can do the same with node, lets see
May 4, 2021, 7:18 PM
i don’t know if it’s the same for python, but deploying a node project to app engine causes app engine to run whatever is in
npm start
by default
May 4, 2021, 7:19 PM
which is
sanity start --port=8080
for me, which is probably why it needs the cli
May 4, 2021, 7:19 PM
aha, that might break things, depending on which port app engine expects the app to listen on
May 4, 2021, 7:20 PM
aha, that might break things, depending on which port app engine expects the app to listen on
May 4, 2021, 7:20 PM
app engine expects 8080 by default
May 4, 2021, 7:20 PM
Ok, I’m almost there. When I connect to /desk it loads fine. I think I just need to fix up my handler for the root
/
and I’ll be good to go.
May 4, 2021, 7:36 PM
Thanks!
May 4, 2021, 7:36 PM
Ok, I’m almost there. When I connect to /desk it loads fine. I think I just need to fix up my handler for the root
/
and I’ll be good to go.
May 4, 2021, 7:36 PM
Ah, sorry. Was waiting for the app update to succeed 🙂 Got this to work: https://gist.github.com/sgulseth/8b342e1427adf83378009c2c6c7761d9
May 4, 2021, 7:40 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?