Embedded Google Maps not working with Google App Engine

Standard

This one was actually pretty easy to solve, but was interesting anyway.

Developing locally I was OK using http requests for my script files as my local server has now issues with using either http or https for requests. However, App Engine has other ideas. In my scripts file I was including the below reference:


http://maps.googleapis.com/maps/api/js?key=My%20API%20Key

This worked no problem on my machine, but when I published to Google App Engine I saw the below:

GMaps_AppEngine.PNG

Once I changed the script to use HTTPS:


https://maps.googleapis.com/maps/api/js?key=My%20API%20Key

I also needed to add my new site to the list of allowed referrers, by going to the Google Cloud Dashboard > APIs and Services > Selecting my project from the dropdown > clicking Maps Javascript API > Credentials > Editing the credential and adding in a record for my site.

Then I was presented with what I wanted to see:

GMaps_AppEngine1.PNG

Advertisements

GCloud SQL – Got an error reading communication packets

Standard

I’m writing an app at the moment and to enable users to test the beta version I’ve decided to host the whole shebang on GCloud, Google’s cloud offering.

The whole process is really straight forward to set up, however there doesn’t seem to be a lot of support from the blogging community…. yet.

My app is written in Node.js with Express and a MySQL back end (to make things easier when it comes to reading the data out with Tableau for my reporting developer who won’t be able to understand NoSQL structures).

A couple of things I’ve noticed:

ALL of your require statements need to be the same case as the names of the physical files. So when your app is looking for routes\admin, your folder best be called routes and your file best be called admin, because if they’re called Routes\Admin (note the upper case first letters) your app hosted in Google’s App Engine won’t start. The same goes for your database schema name and all of your stored procedures. So best to use STRICT mode when you’re developing.

The specific error this manifested itself as in Google SQL was:

gcloudstrict.PNG

I’m using PaperChase for logging and saw the real error there:

gcloudstrict1.PNG

Because my database is called AAU not aau, I was getting access denied errors. These probably should be can’t find routine errors, but in any case I was able to figure out the problem.

Hopefully it helps you too.