4

My preview works and has data but my deployment has no data. I'm using the (Recommended) DEFAULT CLOUD SQL database configuration.

Note: This is only day 4 with Google App Maker. Finding answers to App Maker-specific questions has been super difficult, but I'm making rapid progress on my application, so overall tired but good. :{)

  • Please provide more details if you want people to be able to understand and answer your problem. Have a look at: https://stackoverflow.com/help/how-to-ask – peeyush singh Apr 23 '19 at 01:26
  • Not sure what would be specifically more helpful here... in preview I have data and everything works but then I deploy the app and the deployed version has no data. No errors either, just no data. My question is basically... please list anything you can think of that could cause this condition, in even the most general terms, and that will at least give me a direction to look. For example, are there permissions to check? Is there a "live" setting for the database? Can apps go live in the free trail period... If I knew more about the cause, I wouldn't be asking the question. – Christian Swanson Apr 23 '19 at 01:44

4 Answers4

5

As written in the documentation,

App Maker deployments can use the same Cloud SQL instance, but have separate databases on that instance. Data that you had in preview mode is not available in other deployments. You have a few options for how to handle this situation:

To use data from the preview instance in your published deployment, export the deployment data from the preview instance and import it to the published deployment.

To share a database across all deployments (preview and published), use a custom Cloud SQL database.

TheMaster
  • 45,448
  • 6
  • 62
  • 85
2

When you deploy your app, AppMaker create a new database in your google cloud SQL instance for the deployment. All the data create in previews is in another database.

To use the same database as the preview mode you have to go in the settings of your app in the tab "DATABASE" and copy the Database Key. Then go to your cloud sql instance in google cloud platforme and on the details of the instance in the overview tab just copy the instance connexion name. then edit your deployments and select "Use Custom Cloud SQL database" and copy with the format "instanceConnexionName/DatabaseKey" then save and appmaker should ask you to enter you username and password of your google cloud sql insatnce.

2

On app settings, database page you should see

Databas key: iTIJQaCj491a4111 (Actually this is the name of the mySQL instance)

In GCP console, go to SQL, click on Instance ID, and on the Instance ID overview page is the instance connection name, e.g., MyProject-123456:us-central1:instancename

Back in app settings Select Switch to custom database and enter the full connection string projectname:instancename/schema as

MyProject-123456:us-central1:instancename/iTIJQaCj491a4111

Provide username and password and follow the steps to confirm existing database

SilverFox
  • 41
  • 5
0

Turns out the issue is when you publish it doesn't push the data, you have to manually re-upload the data into the live version. This is actually a good thing, but I wish it'd been explicitly documented. I found it, after figuring it out on my own, in some early release notes from a few years back. I guess I wasn't the only one this stupid.