while deplying app in google app engine i always got following errors...
2014-08-10 03:30:58 Running command: "['C:\\Python27\\python.exe', '-u', u'C:\\Program Files (x86)\\Google\\google_appengine\\appcfg.py', '--no_cookies', u'--email=rjt.rjtshrm94#gmail.com', '--passin', 'update', u'C:\\Users\\Rjt\\Desktop\\New folder (3)']"
03:31 AM Application: my-app-chat; version: 1
03:31 AM Host: appengine.google.com
03:31 AM
Starting update of app: my-app-chat, version: 1
03:31 AM Getting current resource limits.
Password for rjt.rjtshrm94#gmail.com: Invalid username or password.
2014-08-10 03:31:08,612 ERROR appcfg.py:2415 An error occurred processing file '': HTTP Error 401: Unauthorized. Aborting.
Error 401: --- begin server output ---
Must authenticate first.
--- end server output ---
2014-08-10 03:31:08 (Process exited with code 1)
but my emailid and password are correct....
You can close this window now.
I had the same problem and it was driving me mad. I wasn't typing the password wrong.
For me, changing a security setting, not in the app but in my Google account solved it. Go here: https://www.google.com/settings/security/lesssecureapps and "Enable" less secure devices and apps to access your data. For me, that fixed it.
Otherwise I've come accross time settings being the problem (mentioned above).
But more importantly, double-check that the name of your app, that you registered on GoogleDev, is the name that you put in the app.yaml. If it is, then hitting the dashboard in the Launcher should take you to the dashboard of your app.
See my question and answer for more information, if none of this works.
Related
I am using maven plugin 1.9.60 with JDK 8
Running command
mvn install appengine:update -Dappengine.additionalParams="--service_account_json_key_file=client-secret.json"
I could see the version deployed but 0% traffic. Logs says error as below. Could someone suggest how to fix this?
Beginning interaction for module default...
0% Created staging directory at: '/var/folders/ny/z92xw4ps0j71v43mnvjzjyd80000gn/T/appcfg7082099622802800350.tmp'
5% Scanning for jsp files.
8% Generated git repository information file.
20% Scanning files on local disk.
25% Initiating update.
28% Cloning 34 application files.
40% Uploading 2 files.
52% Uploaded 1 files.
61% Uploaded 2 files.
68% Sending batch containing 2 file(s) totaling 1KB.
73% Initializing precompilation...
90% Deploying new version.
95% Closing update: new version is ready to start serving.
98% Uploading index definitions.
Feb. 19, 2018 12:54:48 AM com.google.appengine.tools.admin.AbstractServerConnection send1
WARNING: Error posting to URL: https://appengine.google.com/api/datastore/index/add?app_id=clean-aleph-191303&version=beta-001&
403 Forbidden
You do not have permission to modify this app (app_id=u'f~clean-aleph-191303').
This is try #0
Feb. 19, 2018 12:54:48 AM com.google.appengine.tools.admin.AbstractServerConnection send1
WARNING: Error posting to URL: https://appengine.google.com/api/datastore/index/add?app_id=clean-aleph-191303&version=beta-001&
403 Forbidden
You do not have permission to modify this app (app_id=u'f~clean-aleph-191303').
This is try #1
Feb. 19, 2018 12:54:49 AM com.google.appengine.tools.admin.AbstractServerConnection send1
WARNING: Error posting to URL: https://appengine.google.com/api/datastore/index/add?app_id=clean-aleph-191303&version=beta-001&
403 Forbidden
You do not have permission to modify this app (app_id=u'f~clean-aleph-191303').
This is try #2
Feb. 19, 2018 12:54:49 AM com.google.appengine.tools.admin.AbstractServerConnection send1
WARNING: Error posting to URL: https://appengine.google.com/api/datastore/index/add?app_id=clean-aleph-191303&version=beta-001&
403 Forbidden
You do not have permission to modify this app (app_id=u'f~clean-aleph-191303').
This is try #3
Error Details:
2018-02-19 00:54:17.700:INFO::main: Logging initialized #409ms
2018-02-19 00:54:17.816:INFO:oejs.Server:main: jetty-9.3.18.v20170406
2018-02-19 00:54:19.481:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=1228ms
2018-02-19 00:54:19.497:INFO:oejq.QuickStartDescriptorGenerator:main: Quickstart generating
2018-02-19 00:54:19.512:INFO:oejsh.ContextHandler:main: Started o.e.j.q.QuickStartWebApp#2aceadd4{/,file:///private/var/folders/ny/z92xw4ps0j71v43mnvjzjyd80000gn/T/appcfg7082099622802800350.tmp/,AVAILABLE}
2018-02-19 00:54:19.514:INFO:oejs.Server:main: Started #2231ms
2018-02-19 00:54:19.517:INFO:oejsh.ContextHandler:main: Stopped o.e.j.q.QuickStartWebApp#2aceadd4{/,file:///private/var/folders/ny/z92xw4ps0j71v43mnvjzjyd80000gn/T/appcfg7082099622802800350.tmp/,UNAVAILABLE}
com.google.appengine.tools.admin.HttpIoException: Error posting to URL: https://appengine.google.com/api/datastore/index/add?app_id=clean-aleph-191303&version=beta-001&
403 Forbidden
You do not have permission to modify this app (app_id=u'f~clean-aleph-191303').
Unable to update app: Error posting to URL: https://appengine.google.com/api/datastore/index/add?app_id=clean-aleph-191303&version=beta-001&
403 Forbidden
You do not have permission to modify this app (app_id=u'f~clean-aleph-191303').
appengine-web.xml
```
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>clean-aleph-191303</application>
<version>beta-001</version>
<threadsafe>true</threadsafe>
<runtime>java8</runtime>
</appengine-web-app>
```
pom.xml (plugin declaration)
```
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.9.60</version>
</plugin>
```
Complete bitbucket repo can be found here.
https://bitbucket.org/rohgoyal/springbootgcp-example/src
The issue you are experiencing is due to a missing role on the service account. It probably has the "App Engine Deployer" role assigned but it is missing the "Datastore Index Admin" role and this causes the 403s while POSTing to appengine.google.com/api/datastore/index/
After adding that role, you'll need to regenerate the private key (client-secret.json as you've named it) because the old one won't have the new permissions.
Some more information on roles needed to deploy GAE apps can be found on Deploying using IAM roles section.
Note: Thanks for providing a full repro. It is always helpful.
It is insanely hard, to deploy an app to Google App Engine, using Google Cloud SDK.
I had tried the below 2 commands
C:\Users\yccheok\Desktop\jstock-android-appengine>gcloud config set project jstock-android
Updated property [core/project].
C:\Users\yccheok\Desktop\jstock-android-appengine>gcloud app deploy app.yaml --log-http --verbosity=debug
DEBUG: Running [gcloud.app.deploy] with arguments: [--log-http: "true", --verbosity: "debug", DEPLOYABLES:1: "['app.yaml']"]
DEBUG: No staging command found for runtime [python27] and environment [STANDARD].
DEBUG: API endpoint: [https://appengine.googleapis.com/], API version: [v1]
=======================
==== request start ====
uri: https://appengine.googleapis.com/v1/apps/jstock-android?alt=json
method: GET
== headers start ==
Authorization: Bearer ya29.GlxEBb1XVP1JK93-ARiaN_ZgiMbvZmw5KWfvJVfibDJ4FK_ZaMRoU1jVDTiWzsY606GSduJKJd9Nm8zA-_Iql5mGn4AMk4QVl8mPRycfekeZnOOHtbUvpkBMgOLOQA
accept: application/json
accept-encoding: gzip, deflate
content-length: 0
user-agent: google-cloud-sdk x_Tw5K8nnjoRAqULM9PFAC2b gcloud/184.0.0 command/gcloud.app.deploy invocation-id/c9ae232d33b346d787b95a36e28c38c0 environment/None environment-version/None interactive/True python/2.7.13 (Windows NT 10.0.16299)
== headers end ==
== body start ==
== body end ==
==== request end ====
---- response start ----
-- headers start --
-content-encoding: gzip
alt-svc: hq=":443"; ma=2592000; quic=51303431; quic=51303339; quic=51303338; quic=51303337; quic=51303335,quic=":443"; ma=2592000; v="41,39,38,37,35"
cache-control: private
content-length: 335
content-type: application/json; charset=UTF-8
date: Tue, 16 Jan 2018 19:16:21 GMT
server: ESF
status: 403
transfer-encoding: chunked
vary: Origin, X-Origin, Referer
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
-- headers end --
-- body start --
{
"error": {
"code": 403,
"message": "Operation not allowed",
"status": "PERMISSION_DENIED",
"details": [
{
"#type": "type.googleapis.com/google.rpc.ResourceInfo",
"resourceType": "gae.api",
"description": "The \"appengine.applications.get\" permission is required."
}
]
}
}
-- body end --
total round trip time (request+response): 1.796 secs
---- response end ----
----------------------
DEBUG: (gcloud.app.deploy) Permissions error fetching application [apps/jstock-android]. Please make sure you are using the correct project ID and that you have permission to view applications on the project.
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\cli.py", line 797, in Execute
resources = calliope_command.Run(cli=self, args=args)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\backend.py", line 757, in Run
resources = command_instance.Run(args)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\surface\app\deploy.py", line 65, in Run
parallel_build=False)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\command_lib\app\deploy_util.py", line 543, in RunDeploy
app = _PossiblyCreateApp(api_client, project)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\command_lib\app\deploy_util.py", line 703, in _PossiblyCreateApp
api_client._FormatApp()))) # pylint: disable=protected-access
HttpException: Permissions error fetching application [apps/jstock-android]. Please make sure you are using the correct project ID and that you have permission to view applications on the project.
ERROR: (gcloud.app.deploy) Permissions error fetching application [apps/jstock-android]. Please make sure you are using the correct project ID and that you have permission to view applications on the project.
C:\Users\yccheok\Desktop\jstock-android-appengine>
Then, I went through https://cloud.google.com/appengine/docs/admin-api/accessing-the-api , it mentioned I need to use Admin API. So, I do it step by step carefully.
Step 1
Step 2
It mentions Admin API is enabled. Now I need credential.
Step 3
Step 4
OK. Now they mention I don't need create new credential. I can use Application Default Credentials ?!
Step 5
So, I went to https://developers.google.com/identity/protocols/application-default-credentials?hl=en_GB . I learn that I need to run
C:\Users\yccheok\Desktop\jstock-android-appengine>gcloud auth application-default login
Your browser has been opened to visit:
https://accounts.google.com/o/oauth2/auth?redirect_uri=http%3A%2F%2Flocalhost%3A8085%2F&prompt=select_account&response_type=code&client_id=764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform&access_type=offline
Credentials saved to file: [C:\Users\yccheok\AppData\Roaming\gcloud\application_default_credentials.json]
These credentials will be used by any library that requests
Application Default Credentials.
Step 6
Step 7
Still, after completing the above 7 steps, I still get the exact same error message, when trying to run
gcloud app deploy app.yaml --log-http --verbosity=debug
Can anyone let me know, what step I'm still require, in order to deploy my Python app to Google App Engine, using Google Cloud SDK?
The Admin API is for programmatically deploying the app, not for deploying using gcloud app deploy, for which you don't even need the Admin API enabled for your app.
From Deploying a Python App:
To programmatically deploy your apps, use the Admin API.
Before you begin
Before you can deploy your app:
The Owner of the GCP project must create the App Engine application.
Ensure that your user account includes the required privileges.
(but I can see how the above could be mis-intrepreted as an invitation to use the Admin API)
Most likely the account actually used by gcloud app deploy is missing or doesn't have the required permissions.
You can check the acount used with gcloud auth list. In my case the account is my email address, not a service account (I'm not sure if a service account can be used).
Use gcloud auth login (and maybe gcloud auth revoke) if you need a different account.
And you can check the account's privileges (if any) on the project/app on the IAM Page.
One additional note on this,
When you enable the App Engine API and the cloud builder api, make sure the Cloud Build Service Account also has access to the project.
I ran into that problem after enabling the correct apis.
This was using a build trigger. I could deploy locally from a command line because I was authenticated as myself. However, if you are using a build trigger, it will use the build service account, which needs access.
Hope this helps.
I had this issue. In my case it was solved by setting the project using the project ID, rather than the project name. See this answer
gcloud app deploy ERROR: Permissions error fetching application [apps/<PROJECT_NAME>]
I am running into this error while deploying my app to google app-engine.
Error:
Error 404: --- begin server output ---
This application does not exist (project_id=u'homework-153002'). To create an App Engine application in this project, run "gcloud beta app create" in your console.
--- end server output ---
When I try to create the app using the above command this is what I see:
ERROR: (gcloud.beta.app.create) You do not have permission to access app [homework] (or it may not exist): Operation not allowed
I have created a project in google developers api website with project_name of "homework" and random id. Here is the url for that:
https://console.developers.google.com/apis/library?project=homework-153002
Any pointers on what I might be doing wrong here?
This is my yaml file:
application: homework-153002
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: .*
script: main.app
libraries:
- name: webapp2
version: "2.5.2"
Your app URL indicates your app ID is homework-153002, but the
error message indicates you're connecting to an ap called homework - likely not your own, hence the permission issue.
Simply correcting the app ID in your deployment command and/or your app.yaml file should suffice.
As your comment indicates, for your case (gcloud deployment) the solution was:
gcloud config set project homework-153002
gcloud beta app create
appcfg.py update homework/
I am having an issue where I'm getting a 500 internal error when connecting to my Laravel API.
I had my site originally on GoDaddy using example.com as the main site and api.example.com as the api, but then decided to move it to Google Cloud Platform. I went ahead and set up an instance in the Google Compute Engine using Debian 8. I am using ISPConfig 3 to do all my server stuff. I have my site and my api in two separate repos on Github. I went my server directory to /var/www/example.com/web and cloned my main site into it. Since this create a folder within the root directory of my site, I also went into the vhost and set the default directory to point to the new cloned directory.
I then created another site with ISPConfig for my api and went into the DNS and created a A record and pointed it to the same IP as my main site. I then went into /var/www/api.example.com/web and cloned my api's repo into it, just like my main site. I went into the vhost for my api and pointed the default directory to my new cloned directory.
I can go to example.com just fine, but when I try to log in (this is the first point an api call is made), I get a 500 internal error.
I'm not using CORS and I never have because I use my own JSON web tokens, therefore my CORS is turned off.
Any ideas on how to fix the 500 error?
EDIT
Formatting
Edit 2
These are the last two lines in the error log for apache:
[Sat Sep 24 21:17:17.095798 2016] [core:crit] [pid 17588] (13)Permission denied: AH00529: /var/www/api.example.com/web/api/public/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Sat Sep 24 21:17:17.095875 2016] [authz_core:error] [pid 17588] AH01630: client denied by server configuration: /var/www/api.example.com/web/error/403.html, referer: http://example.com/login
I'm not sure why it's throwing this .htaccess error. It's the .htaccess that Laravel automatically created.
Errors says what is your problem: Permission denied: AH00529: /var/www/api.example.com/web/api/public/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
Make htaccess readable using chmod command:
chmod 644 /var/www/api.example.com/web/api/public/.htaccess
Also check this answers if this not help
In the answer to the question Error sending e-mail via SMTP server on App Engine development server there is a nice solution by Blixt:
"dev_appserver.py does not support TLS
which is required by Gmail. You can
enable it by adding a few lines in api/mail_stub.py:"
# After smtp.connect(self._smtp_host, self._smtp_port)
smtp.ehlo()
smtp.starttls()
smtp.ehlo()
But windows Vista would not let me change api/mail_stub.py
Is there another way to send mail from development server. Other options (Sendmail and ISP are not good for me). Thanks!
EDIT
I changed the api/mail_stub.py according to instructions here and I use the following command-line options:
dev_appserver.py
--smtp_host=smtp.gmail.com
--smtp_port=25
--smtp_user=xxxx#gmail.com
--smtp_password=gmail_pw
C:\Users\A\Desktop\repeater # path to root directory
But I get this error from Log Console:
***********************************************************
2010-11-18 10:24:37 Running command: "['C:\\Python26\\pythonw.exe',
'C:\\Program Files(x86)\\Google\\google_appengine\\dev_appserver.py',
'--admin_console_server=',
'--port=8080',
u'dev_appserver.py',
u'--smtp_host=smtp.gmail.com',
u'--smtp_port=25',
u'--smtp_user=xxxx#gmail.com',
u'--smtp_password=gmail_pw
C:\\Users\\A\\Desktop\\repeater',
'C:\\Users\\A\\Desktop\\repeater']"
Runs a development application server for an application.
dev_appserver.py [options] <application root>
Application root must be the path to the application to run in this server.
Must contain a valid app.yaml or app.yml file.
****************************************************
This is the app.yaml:
application: re-peater
version: 1
runtime: python
api_version: 1
handlers:
- url: /favicon.ico
static_files: static/images/favicon.ico
upload: static/images/favicon.ico
- url: /stylesheets
static_dir: stylesheets
- url: /.*
script: repeater.py
All this works without these command line options. Any suggestions why this is not working?
If you really, really need to send real email from the dev_appserver, you should set up your own mail relay on your machine, and point the SDK at that. I'm curious why it's so important to send real email, though - this is the development server, and you shouldn't be using it for anything other than development.
Change the file permissions so that you can change the api/mail_stub.py file.
This is no longer necessary
in /appengine/api/mail_stub.py
if self._allow_tls and smtp.has_extn ('STARTTLS'):
smtp.starttls ()
I am using appengine sdk version 1.9.15.