My Google App Engine appspot URL wont work - google-app-engine

I recently created my Google App Engine account, and uploaded my application, and have an instance of said app running.
I can access my app via localhost:8080 but when I try to use myappid.appspot.com I get a 500 Server Error (Of course I replace "myappid" with my apps name). This is what it says:
"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."
Can anyone help me get the URL working? I need my team to be able to access this app from anywhere. I have no idea what could be wrong with it, I am very new to GAE. After a lot of searching all I find is people saying their appspot URL works, and want other options. But I just want my appspot URL to work first!
Some more info:
This is a Python app, using the GAE Python SDK, I am running Windows 7, and using the GAE Launcher GUI to deploy and run the app.
Thanks in advance!
EDIT: Here is the error in my Log:
: No module named flask Traceback (most recent call last): File "/base/data/home/apps/s~luxtestapp/1.362824400913245138/bootstrap.py", line 19, in from app import create_app File "/base/data/home/apps/s~luxtestapp/1.362824400913245138/app/init.py", line 10, in from flask import Flask
Apparently the app uses Flask instead of Webbapp2. Honestly I'm not too sure about it all, because this is a pre-built app that I downloaded and deployed. I didn't write it.

In the control panel for your app on appspot go to the log section.
Appengine
The see what the latest entry says. Filter to "error".
Also when you create your app (python webapp2 example) turn debugging on:
app = webapp2.WSGIApplication([
('/', MainHandler)],
debug=True)
You'll get a much more informative error screen then instead of '500'.

You need to copy the flask folder to your project folder. In general every package not supported by GAE (see list of supported libraries), must be present in the project folder.

Try setting the environment variables before/after deploy. Go to the local project folder, open bash the paste this commands: ps: Ignore the $ sign
$ set HTTP_PROXY=http://cache.example.com:3128
$ set HTTPS_PROXY=http://cache.example.com:3128
check this link out for help: cloud.google.com/appengine/docs/python/tools/uploadinganapp

Related

Google App Engine: connection interrupted while running gradle appengineDeploy and now application will not work (including firebase cloud messaging)

While I was deploying my google app engine project (Java) using gradle appengineDeploy my internet connection was interrupted.
I re-deployed the project. Although the console said BUILD SUCCESSFUL, the app engine instance no longer works. No matter how many times I re-deploy or update my application, the logs show nothing but errors:
java.lang.NoClassDefFoundError: com/google/appengine/api/ThreadManager
at
com.google.api.control.extensions.appengine.GoogleAppEngineControlFilter.createClient
(GoogleAppEngineControlFilter.java:61) at
com.google.api.control.ControlFilter.init (ControlFilter.java:141) at
org.eclipse.jetty.servlet.FilterHolder.initialize
(FilterHolder.java:139) at
org.eclipse.jetty.servlet.ServletHandler.initialize
(ServletHandler.java:873) at
org.eclipse.jetty.servlet.ServletContextHandler.startContext
(ServletContextHandler.java:349) at
org.eclipse.jetty.webapp.WebAppContext.startWebapp
(WebAppContext.java:1406) at
com.google.apphosting.runtime.jetty9.AppEngineWebAppContext.startWebapp
(AppEngineWebAppContext.java:175) at
org.eclipse.jetty.webapp.WebAppContext.startContext
(WebAppContext.java:1368) at
org.eclipse.jetty.server.handler.ContextHandler.doStart
(ContextHandler.java:778) at
org.eclipse.jetty.servlet.ServletContextHandler.doStart
(ServletContextHandler.java:262) at
org.eclipse.jetty.webapp.WebAppContext.doStart
(WebAppContext.java:522) at
com.google.apphosting.runtime.jetty9.AppEngineWebAppContext.doStart
(AppEngineWebAppContext.java:120) at
org.eclipse.jetty.util.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:68) at
com.google.apphosting.runtime.jetty9.AppVersionHandlerMap.createHandler
(AppVersionHandlerMap.java:240) at
com.google.apphosting.runtime.jetty9.AppVersionHandlerMap.getHandler
(AppVersionHandlerMap.java:178) at
com.google.apphosting.runtime.jetty9.JettyServletEngineAdapter.serviceRequest
(JettyServletEngineAdapter.java:120) at
com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchServletRequest
(JavaRuntime.java:747) at
com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchRequest
(JavaRuntime.java:710) at
com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run
(JavaRuntime.java:680) at
com.google.apphosting.runtime.JavaRuntime$NullSandboxRequestRunnable.run
(JavaRuntime.java:872) at
com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run
(ThreadGroupPool.java:270) at java.lang.Thread.run (Thread.java:748)
Caused by: java.lang.ClassNotFoundException:
com.google.appengine.api.ThreadManager at
java.net.URLClassLoader.findClass (URLClassLoader.java:381) at
com.google.apphosting.runtime.ApplicationClassLoader.findClass
(ApplicationClassLoader.java:135) at java.lang.ClassLoader.loadClass
(ClassLoader.java:424) at java.lang.ClassLoader.loadClass
(ClassLoader.java:357)
Is there some way for me to clear out the partial build (or whatever there may be) in google app engine?
I tried deleting all versions and instances (you cannot delete them all, it won't let you delete the serving one).
I tried increasing the version number in appengine-web.xml.
I tried gradle clean.
I tried disabling and enabling the application in the google cloud console.
No luck.
One idea I have is maybe if I can somehow force all the files for the app to be uploaded again? Because with gradle appengineDeploy only the changed files get uploaded.
EDIT:
I managed to fix one part of this by upgrading classpath 'com.google.cloud.tools:appengine-gradle-plugin:2.2.0' in my gradle to the latest version. (Felt kind of hackish to do that and not reliable in the future if this happens again.) Maybe this flushed whatever was in app engine or something by doing that. I still have one problem remaining:
I am using the firebase admin SDK to send firebase cloud messages (authenticated with a .json credentials file) like this:
FirebaseMessaging.getInstance().send(msg);
When I do I am getting this error:
com.google.firebase.messaging.FirebaseMessagingException: Unexpected
HTTP response with status: 401; body: null
Which is strange because other parts of the firebase admin SDK are working (like writing/reading from firestore).
So there is still something weird going on and I think it has to do with the fact that as I was uploading my google app engine project the connection was interrupted.
EDIT 2:
Here is something interesting: When I deploy my application using gcloud app deploy appengine-web.xml the application again will not work. Deploying with gradle appengineDeploy does though. I also noticed that the size of the application is shown as much smaller in the GCP console when deploying with gcloud app deploy appengine-web.xml. So something is messed up here. I tried looking up some sort of gcloud command to clear cache? Or something like that but no luck.
EDIT 3:
Additional Info:
My app was already deployed and working before the failed attempt. I changed one small piece of code in a function and upon uploading the app, the connection was interrupted because the internet went out.
I am on app engine standard environment.
I am deploying my application from the macOS terminal and using android studio to develop.
I have tried the stopPreviousVersion promote and version configs in gradle (actually the first two are true by default and version gets auto-generated if you do not set it).
Running gcloud app deploy appengine-web.xml --verbosity=debug shows a lot of sensitive information but one thing I am seeing is all the files in WEB-INF are being skipped:
DEBUG: Skipping upload of [WEB-INF/....
INFO: Incremental upload skipped 100.0% of data
DEBUG: Uploading 0 files to Google Cloud Storage
DEBUG: Using [16] threads
So perhaps files are not all being uploaded? This SO post raises a similar problem but has no solution: stackoverflow.com/q/42137452/3075340
It's weird but when I do gcloud app deploy, the app won't work at all. There are run-time errors all over the place. Doing gradle appengineDeploy fixes that but I still am having the firebase-admin issue.
To actually answer your question, GAE uses a staging bucket to cache files.
You can delete this bucket, and it will get recreated next time you try to deploy.
The bucket is always named staging.[PROJECT-ID].appspot.com. It should show on the buckets overview page
Just to be clear, I'm not anywhere near sure that this will actually resolve your issue, but this will most definitely clear whatever files GAE cached
Here there was a discussion on a, more or less, similar issue on App Engine from last year.
You can use it as a source of inspiration to fix your current issue, because I think they are really similar as a concept. From there I think it may worth trying to put the appengine-api-1.0-sdk-1.9.63.jar ( or whatever your version is ) file under WEB-INF/lib.
It the same post there were some guys who found out the there was a problem with gcloud v194 and switching to another version fixed the issue.
Here there is a similar issue which was resolved by upgrading the gcloud tool.
Anyhow, this behaviour is not normal and things should not work like this. You can try to find a workaround, but my recommendation is to report the issue and let an App Engine engineer taking a look over it. There are good chances to be something internal.

Google App Engine SOAP Not Appearing in phpinfo()

Fatal error: Class 'SoapClient' not found in ../libraries/Shipping/drivers/Shipping_usps.php on line 12
Using Google App Engine for PHP, I receive the error above when try to instantiate a SoapClient object. I've checked phpinfo() and the SOAP extension isn't showing up. When I deploy to production, it does show up, so I figure there's something that's causing the extension not to load locally. I run the dev server from the command line as opposed to the application on Mac OS.
GAE is up to date. Any advice is appreciated.

Can not download code from google app engine

I want to download the code from google app engine.
And I installed python, google engine sdk and executed this command
appcfg.py download_app -a ...
and I typed my mail address and password...
but it says
Error 403: ---
You do not have permission to download this app version
What do you think is the problem? Please help me with this.
I am stuck with this like all day but can't find the solution.
I encountered the same problem (Mac OS, running AppEngineLauncher).
Noticed that no apps were running in GAEL.
Running one of the apps in GAEL (earlier version of the same one - could be a coincidence) seemed to make a difference - it started the download, but then halted.
Then I ran appcfg list_versions on that app, followed by download_app.
That seemed to do the job - download continuing as I write this.
On a guess, appcfg got hazy about its security context. YMMV.
Check:
Only the developer who uploaded the code and the application owner(s) can download it. If anyone other than these parties attempts to download the app, they'll see an error message like the following: Error 403
https://developers.google.com/appengine/docs/python/tools/uploadinganapp#Python_Downloading_source_code
or your app have set permanently prohibit code downloads. Check on page: https://appengine.google.com/deployment/codelock?app_id=your_app_id&to_forward=/permissions?app_id=your_app_id
Adding flag --no_cookies worked for me.

Google app engine and prediction API (error import)

Please help me to solve this error? I'm doing this exercise on app engine (https://developers.google.com/appengine/articles/prediction_service_accounts) , but I'm stuck in step 6.2 because I raise this error(When I run the deploy operation, it is successful step 6.1):
: No module named appengine
Traceback (most recent call last):
File "/base/data/home/apps/s~01prediction/1.367567721220366691/main.py", line 29, in
from oauth2client.appengine import AppAssertionCredentials
The error in line 29 :
from oauth2client.appengine import AppAssertionCredentials
Did you run step 3.2? That should have copied some folders into prediction-demo-skeleton. You should have a folder called oauth2client inside prediction-demo-skeleton. Take a look at the folders that are inside prediction-demo-full.
ps: a good practice before deploying is to run your app using the devappserver.
The Google API Python Client now has a pre-packaged ZIP containing all dependencies that might make installation easier. See:
https://code.google.com/p/google-api-python-client/downloads/list
Select google-api-python-client-gae-1.1.zip for download. Unzip this file inside of your AppEngine app directory.
Along the lines of Sebastian's suggestion it generally is a good idea to test locally using the devappserver. In this case you should be able to get past the import issue, however AppAssertionCredentials won't actually be able to generate any access tokens until it is deployed into a production environment, so it will be of limited use for you.

Uploading app on google app engine

I am new to python and google app. I have an already created application in python and
google app engine. I have downloaded source code of the app and customized it. The source
code which i downloaded doesn't have app.yaml and index.yaml in it. Now i want to know that if i upload my app on google app engine without app.yaml and index.yaml then is there any chance that my data on live server get lost. Please show me right path i am doing any
thing wrong. Also i dont know how to upload a single file on google app engine. Should i have to upload whole app ?
i have used following command for downloading source code on localhost:
appcfg.py download_app -A <your_app_id> -V <your_app_version> <output-dir>
You cannot upload an application without an app.yaml. The app.yaml file contains the necessary configurations to run your application like handlers to use, application ID, runtime, and so on.
Also, you cannot upload a single file to App Engine, you always upload the entire app.
I strongly suggest you do the "Getting Started" guide:
https://developers.google.com/appengine/docs/python/gettingstartedpython27/
before you invest more time in trying to figure out why things don't work.

Resources