I am trying to modify the Counter Mirror Example and get it running from my computer.
Instead of just incrementing by 1, I'd like to increment by 10 (trivial, yes but the goal is to get it running) so I changed the the necessary line in handler.py (in /notify) to:
'increment': lambda num: num + 10,
As for the basic glassware setting up:
In the API console I added the counteraugmented.appspot dot com/oauthcallback and localhost/oauthcallback (i cant post localhost or >2 links, sorry)
Glass API is turned on.
Updated client_secret.json with the id, secret and redirect uri's. Triple checked spelling and all instances included https, not http
Updated app.yaml with application name.
ran:
./appcfg --oauth2 update counteraugmented/
output:
08:43 PM Host: appengine.google.com
08:43 PM Application: counteraugmented; version: 1
08:43 PM
Starting update of app: counteraugmented, version: 1
08:43 PM Getting current resource limits.
08:43 PM Scanning files on local disk.
08:43 PM Cloning 13 static files.
08:43 PM Cloning 60 application files.
08:43 PM Compilation starting.
08:43 PM Compilation completed.
08:43 PM Starting deployment.
08:43 PM Checking if deployment succeeded.
08:43 PM Deployment successful.
08:43 PM Checking if updated app version is serving.
08:44 PM Completed update of app: counteraugmented, version: 1
Went to https://counteraugmented.appspot.com/oauth2callback and got a 404 error.
In the API console log:
2013-08-06 20:53:50.500 /oauth2callback 404 14ms 0kb Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36
70.166.86.68 - - [06/Aug/2013:20:53:50 -0700] "GET /oauth2callback HTTP/1.1" 404 188 - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36" "counteraugmented.appspot.com" ms=15 cpu_ms=0 cpm_usd=0.000021 app_engine_release=1.8.3 instance=00c61b117c0e4f53bedaf5e84288859a16dd0b9e
I successfully got the python quickstart example running, this is my next hurdle.
Any suggestions on how I can go about remedying this would be greatly appreciated. (Obviously new to oauth, stackoverflow and glassdev). Thanks!
Related
Anyone seen the below error message from PHP7 on Google App Engine standard environment?
Error: Server Error
The server encountered an error and could not complete your request.
Please try again in 30 seconds.
Example log from GCP:
xx.xxx.xxx.xx - - [01/Jul/2019:09:16:11 +0100] "GET /api/courses HTTP/1.1" 500 - - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36" "example.com" ms=12009 cpu_ms=3303 cpm_usd=0 loading_request=0 instance=00c61b117c915eddeba77b2a4f20a2ae2b81fc81a941138beb270170b47b91aedffd87f2 app_engine_release=1.9.71 trace_id=1f2cdcf1c2ea56bc5ebf7cf12577b057
I don't see any logs in my PHP application so don't think the issue is there, but I also can't see any details of the error in GCP.
Where do I need to look? Any help appreciated!
Thanks
EDIT
Using gcloud app logs tail reveals the following errors, no idea how to fix these or if they're the cause of the issue!
2019-07-01 19:21:29 default[20190701t094939] nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /tmp/google-config/nginx.conf:3
2019-07-01 19:21:27 default[20190701t094939] [01-Jul-2019 19:21:27] ERROR: unable to read what child say: Bad file descriptor (9)
2019-07-01 19:21:18 default[20190701t094939] [01-Jul-2019 19:21:18] WARNING: [pool app] child 25 exited on signal 7 (SIGBUS) after 0.718745 seconds from start
EDIT 2
I've added caching to a pretty heavy API end point that has stopped these errors from happening, as you can see after I deployed the change on July 1st in the evening. Looking at the 500 logs they seem to correlate with spikes in traffic so if I had to guess maybe the instance was hitting a Memory/CPU limit?!
I'm trying to get JSF 2.2 to run on GAE 1.8.7. I'm following this tutorial: http://java.wildstartech.com/Java-Platform-Enterprise-Edition/JavaServer-Faces/javaserver-faces-22/configuring-jsf-22-to-run-on-the-google-app-engine-using-eclipse
When I run it locally, then the index.jsf page renders well.
However, when I deploy it to GAE, while normal servlets run well, the index.jsf shows a HTTP 505 error with the following in the GAE logs:
2013-11-15 11:23:42.578 /index.jsf 500 533ms 0kb Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36 module=default version=1 W
2013-11-15 11:23:42.573 /index.jsf java.lang.NoSuchMethodError: javax.el.ELContext.notifyBeforeEvaluation(Ljava/lang/String;)V
at com.sun.el.lang.EvaluationContext.notifyBef
2013-11-15 11:23:42.577 Uncaught exception from servlet java.lang.NoSuchMethodError: javax.el.ELContext.notifyBeforeEvaluation(Ljava/lang/String;)V
at com.sun.el.lang.Evalua
I'm using javax-faces.2.2.0.jar and javax-el.3.0.0.jar from maven repository.
If you don't really need the EL 3.x features, then I would suggest moving to a 2.x version and then specifying it in your web.xml file as a context parameter:
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>
The above declaration will ensure that you are using the EL version that is shipped along with your code and not the one provided by the GAE/J container.
Don't forget to include the EL implementation jar as well in your libraries.
p.s.: If it is of any help, I have a starter template on GitHub that can help you get started.
Google App engine always generates 200 for the url /test.js and
test.js is not a static resource, but a url pattern for dynamically generated content. The content will expire after N hours and a fresh content will be generated.
I've tried with Last-Modified, ETag and Cache-Control. None seems to work.
Request
Request URL:http://localhost:8081/test.js
Request Method:GET
Status Code: 200 OK
Accept:*/*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Host:localhost:8081
If-Modified-Since:Fri, 18 Oct 2013 14:10:39 GMT
If-None-Match:"1B2M2Y8AsgTpgAmY7PhCfg"
Referer:http://localhost:8080/
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36
Response Headers
cache-control:public, max-age=360000
Content-Length:2
content-type:application/script; charset=utf-8
Date:Fri, 18 Oct 2013 14:10:40 GMT
etag:"1B2M2Y8AsgTpgAmY7PhCfg"
expires:Tue, 22 Oct 2013 18:10:40 GMT
last-modified:Fri, 18 Oct 2013 14:10:40 GMT
Server:Development/2.0
Your request has Cache-Control:max-age=0, so any intermediate caches (incl. the browser-cache) won't serve cached content. This is likely a result of a setting in your browser.
For requests with revalidate headers (If-X), you need to have the logic in place to act properly. To save bandwidth, this is pretty simple with
webob (which is used by webapp2 and other frameworks) and the conditional-response setting. Avoiding computation as well depends a little more on what you're doing, but webob helps here too.
Redbot is a really useful tool for checking HTTP cache behaviour.
Refer to this for HTTP status:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
200 is just the correct HTTP OK status, that doesn't have any interpretation on whether the resource is static or not. (Try any dynamic web page out there like e.g. facebook) and you will notice it's 200. Having a response of 200 is perfectly normal
for 304 it's "Not Modified" - As mentioned in w3 "The 304 response MUST NOT contain a message-body". This is not what you want.
In your case your concern should be to set the correct expiry time for these http header (do it within your program code), so that the browser always request for a fresh copy of content after the expiry time (e.g. after 1 hour):
cache-control:public, max-age=3600
expires:Tue, 20 Oct 2013 18:10:40 GMT
I have build it from eclipse and ran on development server, it works, when I deploy it on app engine from eclipse, I got this following error, any idea why?
Very first time it went up to oauth2 dance, but it did not succeed, I have fixed redirect-url on api console, then, localhost worked, I did deployed again onto app engine, but it did not work, I got this error:
Error: 500 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.
Error log in App engine console:
2013-06-07 01:59:36.619 /oauth2callback?code={removed now} 500 2416ms 0kb Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36
68.5.238.205 - - [07/Jun/2013:01:59:36 -0700] "GET /oauth2callback?code={removed now} HTTP/1.1" 500 0 - "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36" "{my appid }.appspot.com" ms=2416 cpu_ms=1581 cpm_usd=0.000087 app_engine_release=1.8.0 instance=00c61b117c2c977fac245e8480eff747e75eb6
I 2013-06-07 01:59:34.228
com.google.glassware.AuthFilter doFilter: Skipping auth check during auth flow
I 2013-06-07 01:59:34.230
com.google.glassware.AuthServlet doGet: Got a code. Attempting to exchange for access token.
I 2013-06-07 01:59:35.427
com.google.glassware.AuthServlet doGet: Code exchange worked. User 115370471277937689999 logged in.
W 2013-06-07 01:59:36.614
Error for /oauth2callback
java.lang.NoClassDefFoundError: com/google/common/collect/Lists
at com.google.glassware.NewUserBootstrapper.bootstrapNewUser(NewUserBootstrapper.java:54)
at com.google.glassware.AuthServlet.doGet(AuthServlet.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
This looks like a bug in App Engine and the Google OAuth endpoints. It's being tracked in the Glass issue tracker. You can star that issue to receive updates as the investigation proceeds.
In the mean time, check out the .NET and PHP quick starts. They're working great.
I am getting the following error in App Engine after I deployed it. Does anybody know the reason? It's causing an error page sometimes. It seems simplejson is the cause...
According to http://code.google.com/status/appengine/ everyting should be working accordingly.
09-20 11:03AM 56.027 / 500 55902ms 240cpu_ms 0kb Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; nl-nl) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5,gzip(gfe)
- - [20/Sep/2010:11:04:51 -0700] "GET / HTTP/1.1" 500 0 - "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; nl-nl) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5,gzip(gfe)" "" ms=55903 cpu_ms=240 api_cpu_ms=0 cpm_usd=0.006723 loading_request=1 pending_ms=1266
E 09-20 11:04AM 51.915
<class 'google.appengine.runtime.DeadlineExceededError'>:
Traceback (most recent call last):
File "/base/data/home/apps//7.344918194765199957/main.py", line 11, in <module>
from logic import home, program, image, searchhandler, twitter, sitemap, feed
File "/base/data/home/apps/7.344918194765199957/logic/home.py", line 14, in <module>
from django.utils import simplejson
File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/utils/simplejson/__init__.py", line 95, in <module>
from django.utils.simplejson.decoder import JSONDecoder
File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/utils/simplejson/decoder.py", line 6, in <module>
from django.utils.simplejson.scanner import Scanner, pattern
File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/utils/simplejson/scanner.py", line 3, in <module>
"""
I 09-20 11:04AM 51.924
This request caused a new process to be started for your application, and thus caused your application code to be loaded for the first time. This request may thus take longer and use more CPU than a typical request for your application.
This is the error that the page will show:
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.
It seems this is not the only error causing the 500 error. Because most of the time this seems to be the cause:
09-20 11:37AM 18.229 /ohohcherso.html 500 11007ms 0cpu_ms 0kb Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.62 Safari/534.3,gzip(gfe),gzip(gfe)
94.209.194.233 - sammiestoel [20/Sep/2010:11:37:29 -0700] "GET /ohohcherso.html HTTP/1.1" 500 0 "http://www.tweetstream.nl/index.html" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.62 Safari/534.3,gzip(gfe),gzip(gfe)" "www.tweetstream.nl" ms=11008 cpu_ms=0 api_cpu_ms=0 cpm_usd=0.000148
W 09-20 11:37AM 29.237
Request was aborted after waiting too long to attempt to service your request. This may happen sporadically when the App Engine serving cluster is under unexpectedly high or uneven load. If you see this message frequently, please contact the App Engine team.
Here's your problem:
<class 'google.appengine.runtime.DeadlineExceededError'>
Your page is too slow, it should load within 30 seconds. Otherwise the App Engine will kill it.
http://code.google.com/appengine/docs/python/runtime.html#The_Request_Timer
It seems the real problem was there was a """ in the file as some comments, which created the 500 error. The app is working smooth now. I'm happy I found it at last.
So if you get this error first check if you made comments in a bad way!