Trouble with Google appengine id - google-app-engine

I successfully launched an app locally on the local host
When I deployed to the appengine I got an error.
com.google.appengine.tools.admin.HttpIoException: Error posting to URL: https://appengine.google.com/api/appversion/create?app_id=my_id&version=1&
404 Not Found
This application does not exist (app_id=u'my_id').
For some reason the ID given in the error has u and a space appended in the beginning
I doubled checked the application exists and succesfuly uploaded the app from another computer

All the solutions I can find (like "This application does not exist (app_id=xxx)", or "GAE - Deployment Error: “AttributeError: can't set attribute”") mention running appcfg.py with the --no_cookies
C:\Program Files (x86)\Google\google_appengine\appcfg.py
appcfg.py --no_cookies update my-app-folder\
# or (2-steps verificatio enabled)
appcfg.py --oauth2 --no_cookies update my-app-folder\
If the project contains Java7 classes, you need to add the --use_java7 option, as shown in the question "Failed to deploy to Google App Engine because --use_java7 flag has not been set".
While you can run appcfg from the GAE installation path, the page "Using the Google Plugin for Eclipse" mentions (at the bottom of the page):
Some features of the App Engine Java SDK tools are only available by running the tools directly from the command line. If you have installed the SDK using Eclipse, you can run these tools from the Eclipse plugin installation directory.
The SDK is located in your Eclipse installation directory, under plugins/com.google.appengine.eclipse.sdkbundle_VERSION/, where VERSION is a version identifier for the SDK.
In this directory is the appengine-java-sdk/bin/ subdirectory containing the tools.

Related

how can i use Google Cloud SDK in local development server in Windows machine?

I have already installed Google Cloud SDK in my Windows machine. In the Google Cloud SDK shell, I run the following command,
dev_appserver.py c:/helloworld
helloworld is the folder containing where app.yaml and helloworld.py. But it's showing the following error
raise yaml.errors.eventerrors.......

My app in the google app engine won't deploy

Whenever I try to deploy my app (a proxy) it returns this message:
C:\Python27\pythonw.exe: can't open file 'C:\Program Files\Google\google_appengine\appcfg.py': [Errno 2] No such file or directory
2013-12-05 00:16:31 (Process exited with code 2)
I've checked it a thousand times and both the app in the engine and the title of the project on my app engine account page, have the same server name. I set the preferences correctly, yet the error is always that the file doesn't exist.
The error is saying the program appcfg which does the deployment doesnt exist.
Something about you SDK environment is wrong. Have a look and see if you can find appcfg.py in the patgh in the error message, and check where your SDK is currently installed.

Unable to deploy app to App engine

I have a GWT based web application that I have previously uploaded to Appspot.
However now, I am getting this error:
Unable to update:
com.google.appengine.tools.admin.JspCompilationException: Failed to compile jsp files.
at com.google.appengine.tools.admin.Application.compileJsps(Application.java:583)
at com.google.appengine.tools.admin.Application.createStagingDirectory(Application.java:434)
at com.google.appengine.tools.admin.AppAdminImpl.doUpdate(AppAdminImpl.java:327)
at com.google.appengine.tools.admin.AppAdminImpl.update(AppAdminImpl.java:52)
at com.google.appengine.eclipse.core.proxy.AppEngineBridgeImpl.deploy(AppEngineBridgeImpl.java:400)
at com.google.appengine.eclipse.core.deploy.DeployProjectJob.runInWorkspace(DeployProjectJob.java:148)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
The application used JDK (not JRE)
There's a JSP file (dummy) on the war file
The application works in hosted mode
Do a clean build first. Alt+P, N in eclipse. If this fails, delete /war/WEB-INF/classes and try again. If this also fails, right click your war folder and select validate; this will tell you if there are any actual errors in your jsp files.
If this fails, your appengine jars may be corrupted. Try unzipping a fresh SDK and using it to deploy.
Also, have you changed java versions recently? Compiling JSPs requires JAVA_HOME points to a JDK, not a JRE. What is the result of echo $JAVA_HOME?
this thread will solve your problem
Cannot get the System Java Compiler. Please use a JDK, not a JRE
Other wise, you need to set your JAVA_HOME to point to your jdk folder and add javaw.exe path in your eclipse.ini

Google app engine request_logs command line --include_all option is not available

I saw this link - App engine CPU times when downloading logs that refers to a question about how to get the performance information when downloading logs from google app engine with --include_all option.
I've tried it with the Java command line options and read the documetnation and it is not mentioned there at all!
How can I get the performance infromation such as cpu time when I download the logs from app engine?
The command I'm currently using (it works) is:
appcfg.cmd --num_days=3 --severity=0 request_logs . logs.txt
In the admin dashboard you can see this information:
"<my_app_name>.appspot.com" ms=13 cpu_ms=0 api_cpu_ms=0 cpm_usd=0.000102
I want to be able to get this information in the logs as well.
thanks,
Li
The Java version of appcfg doesn't currently support that flag. You can create an app.yaml and use the Python version of the SDK to download the logs, though.

How do I download the source code of a google app engine project?

This seems like it should be very easy but I don't see a link to it anywhere.
How do I download the source code of a google app engine project?
Windows
appengine-java-sdk\bin\appcfg.cmd -A <your_app_id> -V <your_app_version> download_app <output-dir>
Linux
./appengine-java-sdk/bin/appcfg.sh -A <your_app_id> -V <your_app_version> download_app <output-dir>
For completeness, using the Python implementation:
appcfg.py download_app -A $appID -V $appVersionNumber $downloadDirectory --oauth2
--oauth2 is of course optional, you can omit it and provide your email + app-specific password (or your password, and then go implement two-factor authentication right after), but it's easier, and frankly there's no reason not to.
Documentation.
App Engine actually recently added the ability for the developer who uploaded a given app version to download its source code.
As of October 2019 you can simply go to --> App Engine --> Services and in the tool dropdown select 'source' and the source code is there
Posting this since none of the listed methods above didn't take me to the code (by June 2021)
You could try accessing it through;
Google Cloud Platform > Debugger > choosing the version of the
Application from combo at top.
This will list the files of that version on the left pane. There is no way to download it automatically but you can copy-paste the code.
Hope you will find this helpful.
IMHO, the best option today (Aug 2018) is:
Under the main menu, under Products, go to Tools -> Cloud Build -> Build history.
There, click the ID of the build you want (for me - the last one).
Then, in the opened window (Build details), click the "source" link, the download of your compressed code begins.
As simple as that.
HTH.
Working with App engine standard using Go, the debugger isn't available yet.
How I managed to download the source code for an existing service was to use the gcloud tool.
First: Get the version id of your service using the app engine console or running: gcloud app versions list
Second: use the version and service name and run: gcloud app versions describe <versionID> --service=<service name>
the describe parameter will give you the storage locations for your source files that looks like this:
cmd/main.go:
sha1Sum: e3fe5848c2640eca7ac3591490e1debc2d3a9b09
sourceUrl: https://storage.googleapis.com/<project>/<file id>
Third: you can then use the storage console, using the file id, to download the files you are interested in.
this process based on java sdk
Its works for me...
Download Google cloud SDK
gcloud init
enter image description here
Follow through process of logging in using your credentials
Enter following command from SDK
C:\Program Files (x86)\Google\appengine-java-sdk-1.9.49\bin
enter image description here
Enter Following command to download source code
appcfg.sh -A [YOUR_APP_ID] -V [YOUR_APP_VERSION] download_app [OUTPUT_DIR]
Eg: appcfg.sh -A my-project-name-1234 -V 2 download_app C:\Users\india\Desktop\my project
Note: this progress based on java-appengine sdk so we use appcfg.sh instead of appcfg.py
check if your app is uploaded with same email id that is in your app engine. if you are not sure then in app engine > control > Clear deployment credentials and then click on any project, deploy to sign in again then use this
appcfg.py download_app -A {app id from google app engine} -V {1} "{c:\path}" --oauth2_credential_file=C:\Users\{your account name}/.appcfg_oauth2_tokens
change all {} to your needs
Things have changed since this question was asked so I'm adding an updated answer. Note that this only applies to GAE Standard Environment
Google has deprecated appcfg.py and so the previous responses appcfg.py download_app no longer works.
gcloud which is the SDK in use (it replaced appcfg) does not have the functionality to download your source code.
When you deploy your app via gcloud app deploy, it copies your source code to a bucket. The default bucket is staging.<project_name>.appspot.com. Your files will stay in this bucket for a maximum of 15 days before they are deleted. You can modify the rule so that the files are retained for longer or less time.
The file names in the bucket are encoded so you can't figure out what each file is unless you open it (i.e. download it). Google has a mapping of the encoded names to the original file names. To get this mapping, you run the gcloud app versions describe command and it will list the file names and their encoded names. To download the files, you have to manually click each url one by one. So essentially, you have to download each file manually and then use the mapping to rename them (or open the file, check the content and then rename them). Also note that downloading the files manually will not maintain the folder structure in which they were uploaded.
If you do not wish to go through all of the above hassles (imagine having to manually open each url for each file if you have a small to mid-sized project which has hundreds of files), our App - https://nocommandline.com - now supports downloading source code from the default bucket - staging.<project_name>.appspot.com (so far as your files are still there which means any deployment i.e update not older than 15 days from your current date unless you previously increased the deletion age on your staging bucket's lifecycle page).
In simple terms, you enter your project name, the version number and our App will take care of retrieving the original file name to encoded name mapping, automatically downloading the files and renaming them to the original names, while maintaining the folder structure. For more information, refer to https://nocommandline.com/help/#faq_download_source_code_from_gae.
Log in to the console.developers.google.com
Select the project you want to download the code from (Google App Engine Standard Envoronment).
Go to the App Engine Dashboard. Under Summary is Debug and Source. Click on Source.
Select each file one at a time and copy it (highlight the code, copy and paste into your local editor.)
Select the next file....
You need to use svn to checkout the files.
If you are on Windows, you can use tortoise svn for your GUI end.
Here are tutorials on how to do it, here is the related question.

Resources