Cannot authorize my google app to access my Cloud SQL instance - google-app-engine

I have deployed an application on App Engine. Now I m trying to grant access to this app to be able to access my Cloud SQL instnace. The step is simple and straightforward as described here:
https://developers.google.com/cloud-sql/docs/access_control
However when I fill in the app id and push " save changes" I get the error:
"An unexpected error has occurred. We're looking into it."
Anybody has an idea about that issue?
UPDATE:
After spending some time on the issue I made the following observations:
I m located in the European Union. Therefore I created an Cloud SQL instance in the european Union zone. When I try to add an authorized application to my SQL instance I get the error that posted above:
"An unexpected error has occurred. We're looking into it."
Then I created a new SQL instance in United States. I was then able to authorize application for that instance. However my application was not able to access the US SQL instance since I guess my app is deployed somewhere in European Union.
Could someone from the google support team confirm my observations and explain me how can i solve this issue?

Your GAE app and Cloud SQL instance must be in the same location:
https://developers.google.com/cloud-sql/faq#location
You can currently (Nov 27, 2012) create GAE apps in the EU only if you are a premier customer.
https://developers.google.com/appengine/docs/premier/location

This a known issue with Cloud SQL - currently the app and the Cloud SQL locations must match. Unfortunately you currently can't have a (free) EU app. So its catch 22 if you've chosen an EU Cloud SQL. You need to delete your current SQL instance and add a new one that is in the US.
That doesn't explain your second issue though - if the instance allows you to add the app, then the app must be in the US and you are facing a different issue. Also note that if you have a free app then it is by definition in the US - you can't currently choose app location on the free version.
I am not a Google support btw :D This info is from replies to me from Google people in the google group.

Related

Betfair Non-Interactive (Bot) login doesn't work in Google App Engine region eu-west2 (London)

The error I'm getting is BETTING_RESTRICTED_LOCATION. But when I run my app locally using London location from VPN I am able to login in perfectly.
Is there a way I can ensure that the app is running from places where betting is legal?
There is another question like this but its very old and doesn't help me.
The IPs of Google Cloud Platform share the same geolocation (US). And it could be possible that your bot doesn't allow connections from this part of the world. If this is the issue, there isn't any available solution within GCP just yet. You can follow this feature request or in the meantime, just point the requests to an on-prem service hosted in London that acts as a proxy.

CloudSQL Second Generation -- can't authorize application to access

I'm creating V2 beta instances and I can't add an authorized application to these instances. As you can see, the manage link doesn't even appear. How can I add an appengine application as authorized? I've had no problem with the first gen instances.
Further, clicking on Access Control, the UI to add an authorized application doesn't even appear:
This is an old question from before App Engine connectivity was supported for Second Generation instances.
Please follow the instructions here: https://cloud.google.com/sql/docs/mysql/connect-app-engine
Old answer for posterity:
App Engine connectivity is not yet available for Second Generation instances.
See the limitations noted on the following page:
https://cloud.google.com/sql/docs/introduction#v2
Please also see:
2nd generation Google cloud SQL - App Engine

Is it possible to access Google Play Game Services API with service account?

I've created the game thru Google Play Developer Console (it is ready for testing, but not published yet).
Two service accounts are added there as testers - myappid#appspot.gserviceaccount.com (Google App Engine service account) and 64436212345-enq9gkd1abcdefghjec2kha39je5ojsc#developer.gserviceaccount.com (manually created service account, it was created before an access to Google Play Game Services API was given). First one is used for production GAE environment, second one is for development environment (run with --appidentity_email_address). Both accounts work well with Google Analytics API.
Now I try to use these accounts to work with Google Play Game Services API.
The following code is used for authorization and works fine:
credentials = AppAssertionCredentials(scope=['https://www.googleapis.com/auth/games', 'https://www.googleapis.com/auth/plus.login'])
http = credentials.authorize(httplib2.Http(memcache))
But I am getting an error when trying to access achievements definition (also tried to get application metadata - got the same issue):
response = service.achievementDefinitions().list().execute()
In development environment I get
<HttpError 404 when requesting https://www.googleapis.com/games/v1/achievements?alt=json returned "The requested application with ID 64436212345 was not found.">
and in production:
<HttpError 500 when requesting https://www.googleapis.com/games/v1/achievements?alt=json returned "">
What is wrong there? Are service accounts supported by Google Play Services API?
Upd. Further analysis showed that 64436212345 is an ID of my GAE application, when an ID of my Google Play application is 760943112345.
So, I went to Google Developer Console for application 760943112345 and added 64436212345-enq9gkd1abcdefghjec2kha39je5ojsc#developer.gserviceaccount.com and myappid#appspot.gserviceaccount.com as the member their. It didn't help.
Then I generated new service account ID there and run GAE locally with this service account. In result, I've started to get
<HttpError 401 when requesting https://www.googleapis.com/games/v1/applications/760943112345?alt=json returned "User has not completed registration.">
Of course, my service account doesn't have Google+ profile.
I am also struggling with service accounts and Google game services, and am stuck at the same point (my service account doesn't have a G+ account).
The only indication I have found in the Google literature (supposedly Updated Jan 22, 2014) says service accounts are not supported:
Warning: Very few Google APIs currently support Service Accounts. Service accounts are >currently supported by the following Google developer services:
Google Cloud Storage
Google Prediction API
Google URL Shortener
Google OAuth 2.0 Authorization Server
Google BigQuery
This is embedded in some google api php client documentation however, so I cannot attest its validity.
Let me know if you have any luck getting this to work and I'll do the same!
Edit: here is the actual answer:
You have to create another API project and link it to your game's project, as explained in Getting Started with the Google Play Games Services Publishing API. The service accounts that you add to your game's project won't work. Also, you have to add this new API project through Google Play Developer Console, and not through Google Developers Console. As far as I remember, you go to the latter to get your key only. This whole situation took me forever to figure out.
I'm keeping the below text for future reference:
Edit: I wrote the answer below, thinking that you did not talk about the Publishing API. But you are, it seems. Or an earlier version of it. I hope the below answer will be useful for people looking to access Management API with a service account:
I struggled with the same and concluded that service accounts do not work with the GPGS Management API, which is the API that deals with achievements and things of that sort. Here are the facts that I used to reach this conclusion:
The only place in GPGS docs that service accounts are mentioned is the Publishing API.
Management API Docs contains descriptions for each function about the authorization requirements such as: "This method is only available to user accounts for your developer console.", while Publishing API Docs have no such descriptions.
The sample app for Management API does not use a service account.
It would be nice if this was a bit clearer in the GPGS docs. The generic Google Cloud docs that they link from GPGS pages made me believe that service accounts would work.

Google App Engine Datastore Admin is disabled due to application hidden by an alias

Recently I migrated my application to the High-Replication datastore using the migration tool.
The Datastore Admin page now isnt diplaying correctly:
Error: Server Error
The server encountered an error and could not complete your request.
If the problem persists, please report your problem and mention this
error message and the query that caused it.
When I visit the Datastore Admin in the old application (the one I migrated from) I get the following notifications:
This application is hidden by an alias. The application lrweb2012 has
an alias that causes it to receive all traffic normally directed at
this one. Unless you are looking for historical data, you probably
want to see that application.
Datastore Admin is disabled. Because lrweb2012 has an alias that
shadows this application the Datastore Admin tool cannot be used.
Can anyone experianced suggest what is going on, and how I may go about resolving this issue?
Cheers,
You migrated your app, so you probably want to be looking at the admin for lrweb2012-hrd (or wherever you migrated it to) instead of the old setup.
Use the drop-down at the top-left corner to pick a different app.

Google Cloud SQL connection error

I am new to Google App engine and I have tried to run an demo application called guestbook to connect to Google cloud sql from the Google app engine with app-engine-sdk version 1-7.0. But each time I am getting an error saying "java.lang.IllegalStateException: System property rdbms.driver must be set at com.google.appengine.api.rdbms.dev.LocalRdbmsServiceLocalDriver.registerDriver(LocalRdbmsServiceLocalDriver.java:80)". I double check my code and every thing looks ok, and I still have no glue where the error coming from.
Below is a snippet of my connection code :
c = DriverManager.getConnection("jdbc:google:rdbms://my_instance/my_database");
and mysql-connector-java-5.1.21-bin is in the class path,
and I have enable Google cloud sql in the Google app engine,
and I have checked the use of Google Cloud instance in the app engine as well with the my instance of the database, database name, login , and password,
and I am using Eclipse Juno.
I think I have missed something important; so would you please help me if you know what I have missed.
Thank you very much in advance,
Minh
Once you are new to GAE I recommend to give a try on the Big Table database. Using it you will not have to setup any database localy. So just the eclipse plugin will be enough for your first test. The Guestbook uses this database so it will be easier to follow the tutorial.

Resources