notes.dt.in.th

Disabling an App Engine service without also disabling Firestore

I switched one of my Google Cloud projects from Google App Engine to Google Cloud Run because it is cheaper for my use case.

Once the migration is completed, I disabled the Google App Engine app.

Everything breaks

So the App Engine app is successfully disabled but my app (which runs on Cloud Run) also stops working. Turns out, the problem is, disabling App Engine also disables Firestore, a Firebase service. When I attempt to use Firestore, I get an error:

The project MY_PROJECT does not exist or it does not contain an active Cloud Datastore or Cloud Firestore database. Please visit http://console.cloud.google.com to create a project or https://console.cloud.google.com/datastore/setup?project=MY_PROJECT to add a Cloud Datastore or Cloud Firestore database. Note that Cloud Datastore or Cloud Firestore always have an associated App Engine app and this app must not be disabled.

Deleting the service

So, instead of disabling App Engine, I will leave it enabled and I’ll just delete the service, so that I don’t get charged for the compute instance. It turns out that the default service cannot be deleted.

Stopping the service

Ok, alright, so I will not delete the service. Instead, I will stop it, so that no instance will be running. However, apps in the standard environments cannot be stopped in some circumstances.

Replacing the service

So I need switch the service to the flexible environment, so that it can be stopped. One way to do this is to deploy a hello world application to replace the service.

git clone https://github.com/GoogleCloudPlatform/nodejs-docs-samples
cd nodejs-docs-samples/appengine/hello-world/flexible
gcloud app deploy

Stopping the service for real

Finally, the service can be stopped.

Once stopped, I confirmed that the Instance Count is 0.