Google App Engine Go SDK: Request to '/' failed - google-app-engine

i'm just getting started using GAE, i have following guide in here https://developers.google.com/appengine/docs/go/gettingstarted/devenvironment and some hello word tutorial here https://developers.google.com/appengine/docs/go/gettingstarted/helloworld .
my problem is when i'm typing goapp serve it works. and show log like this:
INFO 2014-05-18 08:44:57,130 devappserver2.py:765] Skipping SDK update check.
WARNING 2014-05-18 08:44:57,135 api_server.py:374] Could not initialize images API; you are likely missing the Python "PIL" module.
INFO 2014-05-18 08:44:57,140 api_server.py:171] Starting API server at: http://localhost:59559
INFO 2014-05-18 08:44:57,154 dispatcher.py:182] Starting module "default" running at: http://localhost:8080
INFO 2014-05-18 08:44:57,156 admin_server.py:117] Starting admin server at: http://localhost:8000
but, when i'm trying to access http://localhost:8080 , it not show me "hello, world!" in the browser. and error log show me like this:
ERROR 2014-05-18 08:48:05,002 module.py:714] Request to '/' failed
Traceback (most recent call last):
File "/home/bayu/.go_appengine/google/appengine/tools/devappserver2/module.py", line 708, in _handle_request
environ, wrapped_start_response)
File "/home/bayu/.go_appengine/google/appengine/tools/devappserver2/request_rewriter.py", line 311, in _rewriter_middleware
response_body = iter(application(environ, wrapped_start_response))
File "/home/bayu/.go_appengine/google/appengine/tools/devappserver2/module.py", line 1228, in _handle_script_request
request_type)
File "/home/bayu/.go_appengine/google/appengine/tools/devappserver2/instance.py", line 382, in handle
request_type))
File "/home/bayu/.go_appengine/google/appengine/tools/devappserver2/http_proxy.py", line 148, in handle
connection.connect()
File "/home/bayu/.pyenv/versions/2.7.6/lib/python2.7/httplib.py", line 772, in connect
self.timeout, self.source_address)
File "/home/bayu/.pyenv/versions/2.7.6/lib/python2.7/socket.py", line 571, in create_connection
raise err
error: [Errno 111] Connection refused
INFO 2014-05-18 08:48:05,007 module.py:639] default: "GET / HTTP/1.1" 500 -
i have google it and trying another get started tutorial in here http://blog.joshsoftware.com/2014/03/12/learn-to-build-and-deploy-simple-go-web-apps-part-one/
but it's not work also.
what should i do?
i'm on ubuntu 12.04 , Python 2.7.3, go version go1.2.1 linux/386
using go_appengine_sdk_linux_386-1.9.4.zip
this is my hello.go and app.yaml
hello.go
package hello
import (
"fmt"
"net/http"
)
func init() {
http.HandleFunc("/", handler)
}
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Hello,")
}
app.yaml
application: helloworld
version: 1
runtime: go
api_version: go1
handlers:
- url: /.*
script: _go_app
thank you,

Not sure if this will help anyone or not but I came across the exact same issues and finally tracked it down to my hosts file. Basically what is happening is the app engine server is running on 0.0.0.0:8080 yet the interface / output is displaying localhost:8080. In my hosts file 0.0.0.0:8080 wasn't mapped to localhost so:
edit your /private/etc/hosts file with vim or whatever
add 0.0.0.0 localhost to your hosts file
save, start a new terminal and try and run you appengine server again
After that simple edit everything worked for me.

Related

Using gcloud console for Google App Engine causes a Runtime error from metrics

I'm trying to use the gcloud console through the browser. When I clone my repository and start the dev server, I get a runtime error from metrics:
$ dev_appserver.py $PWD
Traceback (most recent call last):
File "/google/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 101, in <module>
_run_file(__file__, globals())
File "/google/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 97, in _run_file
execfile(_PATHS.script_file(script_name), globals_)
File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 1041, in <module>
main()
File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 1037, in main
dev_server.stop()
File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 845, in stop
metrics.GetMetricsLogger().Stop()
File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/metrics.py", line 117, in Stop
total_run_time = int((Now() - self._start_time).total_seconds())
TypeError: unsupported operand type(s) for -: 'datetime.datetime' and 'NoneType'
I'm not calling the metrics module directly or otherwise using it. How can I disable it in the console or in the code so that I can start my app ok?
It runs ok locally via the SDK.
dev_appserver.py metrics were recently added in the Cloud SDK version 144.0.0 for users who have opted-in during SDK installation. The Cloud SDK installation provided in the Cloud console at https://console.cloud.google.com is also opted in to using these metrics.
In response to this post, we've added some additional logic to prevent this misleading error message in the future. This update will appear in one of the upcoming releases.
I got this working by resolving an issue in my app.yaml file, one of my routes wasn't specified correctly.
Fixing that route with a leading slash, and escaping the dot within the route regex, seemed to resolve the error too:
diff --git a/app.yaml b/app.yaml
index 8a165a0..39c68b3 100644
--- a/app.yaml
+++ b/app.yaml
## -13,7 +13,7 ## handlers:
- url: /ui
static_dir: ui
-- url: robots.txt
+- url: /robots\.txt$
static_files: robots.txt
upload: robots.txt

Deploying an app on Google App Engine path to certificate not provided error

For the past few days I have been trying to trace the source of the error shown in the blockquote in trying to deploy an app to google app engine on a windows machine using the command:
> gcloud preview app deploy app.yaml
Beginning deployment... Verifying that Managed VMs are enabled and
ready.
Traceback (most recent call last): ...
File "C:\Program Files\Google\Cloud
SDK\google-cloud-sdk\bin.../lib\docker\docker\tls.py", line 46, in
init
'Path to a certificate and key files must be provided'
TLSParameterError: Path to a certificate and key files must be
provided through the client_config param. TLS configurations should
map the Docker CLI client configurations.
Does anyone have any idea on how to solve this issue?
FYI: I have already set the environment variables DOCKER_CERT_PATH, DOCKER_TLS_VERIFY and DOCKER_HOST as set by Docker.

fail to execute php-cgi for google app engine under windows

OS: windows 8
google app engine sdk 1.8.2
C:\google_appengine>dev_appserver.py --php_executable_path=D:\php5417 D:\helloworld
INFO 2013-08-03 16:13:43,874 sdk_update_checker.py:244] Checking for updates to the SDK.
INFO 2013-08-03 16:13:45,128 sdk_update_checker.py:260] Update check failed: HTTP Error 404: Not Found
WARNING 2013-08-03 16:13:45,148 api_server.py:314] Could not initialize images API; you are likely missing the Python "PIL" module.
INFO 2013-08-03 16:13:45,164 api_server.py:138] Starting API server at: http://localhost:9024
INFO 2013-08-03 16:13:45,171 dispatcher.py:164] Starting module "default" running at: http://localhost:8080
ERROR 2013-08-03 16:13:45,176 php_runtime.py:216] The PHP runtime is not available
Traceback (most recent call last):
File "C:\google_appengine\google\appengine\tools\devappserver2\php_runtime.py", line 212, in new_instance
self._check_environment(php_executable_path)
File "C:\google_appengine\google\appengine\tools\devappserver2\php_runtime.py", line 156, in _check_environment
env={})
File "C:\google_appengine\google\appengine\tools\devappserver2\safe_subprocess.py", line 61, in start_process
stdin=subprocess.PIPE)
File "C:\python\lib\subprocess.py", line 711, in __init__
errread, errwrite)
File "C:\python\lib\subprocess.py", line 948, in _execute_child
startupinfo)
WindowsError: [Error 5] 存取被拒。
INFO 2013-08-03 16:13:45,177 admin_server.py:117] Starting admin server at: http://localhost:8000
--php_executable_path should point to the actual executable file. So you probably want something like:
--php_executable_path=D:\php5417\php-cgi.exe

importing 3rd party libraries into app engine

Im having trouble getting app engine to accept a 3rd party library.
ive copied it into the the app engine directory, but i keep getting the error, "invalid object, the library tweepy is not supported" in blah blah blah/app.yaml
could somebody point out the obvious mistake please?
thanks
ok, ive made a few changes to the code and now i get this error, hopefully it is more useful
2012-10-15 20:09:36 Running command: "['C:\\Python27\\pythonw.exe', 'C:\\Program Files\\Google\\google_appengine\\dev_appserver.py', '--admin_console_server=', '--port=8083', 'C:\\Documents and Settings\\ladds\\My Documents\\udacity\\whycantisigh']"
WARNING 2012-10-15 19:09:54,140 rdbms_mysqldb.py:74] The rdbms API is not available because the MySQLdb library could not be loaded.
WARNING 2012-10-15 19:09:56,171 datastore_file_stub.py:513] Could not read datastore data from c:\docume~1\ladds\locals~1\temp\dev_appserver.datastore
WARNING 2012-10-15 19:09:56,203 dev_appserver.py:3394] Could not initialize images API; you are likely missing the Python "PIL" module. ImportError: No module named _imaging
INFO 2012-10-15 19:09:56,328 dev_appserver_multiprocess.py:647] Running application dev~whycantisigh on port 8083: #http://localhost:8083
INFO 2012-10-15 19:09:56,328 dev_appserver_multiprocess.py:649] Admin console is available at: #http://localhost:8083/_ah/admin
WARNING 2012-10-15 19:10:26,171 py_zipimport.py:139] Can't open zipfile C:\Python27\lib\site-packages\oauth2-1.0.2-py2.7.egg: IOError: [Errno 13] file not accessible: 'C:\Python27\lib\site-packages\oauth2-1.0.2-py2.7.egg'
WARNING 2012-10-15 19:10:26,171 py_zipimport.py:139] Can't open zipfile C:\Python27\lib\site-packages\ply-3.4-py2.7.egg: IOError: [Errno 13] file not accessible: 'C:\Python27\lib\site-packages\ply-3.4-py2.7.egg'
WARNING 2012-10-15 19:10:26,187 py_zipimport.py:139] Can't open zipfile C:\Python27\lib\site-packages\tweepy-1.11-py2.7.egg: IOError: [Errno 13] file not accessible: 'C:\Python27\lib\site-packages\tweepy-1.11-py2.7.egg'
INFO 2012-10-15 19:10:30,171 dev_appserver.py:2884] "GET / HTTP/1.1" 405 -
INFO 2012-10-15 19:18:04,250 py_zipimport.py:148] zipimporter('C:\Python27\lib\site-packages\oauth2-1.0.2-py2.7.egg', '')
INFO 2012-10-15 19:18:04,250 py_zipimport.py:148] zipimporter('C:\Python27\lib\site-packages\ply-3.4-py2.7.egg', '')
INFO 2012-10-15 19:18:04,250 py_zipimport.py:148] zipimporter('C:\Python27\lib\site-packages\tweepy-1.11-py2.7.egg', '')
INFO 2012-10-15 19:18:06,640 dev_appserver.py:2884] "GET / HTTP/1.1" 405 -
im sorry its not formatted clearly, but it will only let me format the first line.
anyway, the gist of the problem seems to be that 3rd party libraries i have downloaded into python(and that work in the shell) arent accessible by app engine.
thanks
https://developers.google.com/appengine/kb/libraries
Many Native C Python modules are disabled with Google App Engine. The Python 2.7 runtime supports more modules than the Python 2.5 runtime.
It would help if you showed your app.yaml and the actual error message instead of blah blah blah.
But most likely you put tweepy in app.yaml and you don't need to.
Edit
To use 3rd party libraries with GAE, you need to put a copy of the library in your project folder. Otherwise, it won't get uploaded to the server on deploy. Installing it to your python path won't work.

When I open my http://localhost:9999/ the page is not found; what is the problem?

Im using google app engine python with aptana studio 3 and pydev;
The debug config is:
mainmodule: C:\Program Files\Google\google_appengine\dev_appserver.py
arguments:
"${project_loc:test}/src"
--port=9999
and the console is:
pydev debugger: warning: psyco not available for speedups (the debugger will still work correctly, but a bit slower)
pydev debugger: starting
WARNING 2011-02-24 11:11:09,447 urlfetch_stub.py:74] No ssl package found. urlfetch will not be able to validate SSL certificates.
INFO 2011-02-24 11:11:09,665 appengine_rpc.py:153] Server: appengine.google.com
WARNING 2011-02-24 11:11:09,691 datastore_file_stub.py:573] Could not read datastore data from C:\Users\Psoares\Desktop\outros\WEB DEV\Rubete 2010 Survey\ds
WARNING 2011-02-24 11:11:09,703 dev_appserver.py:3700] Could not initialize images API; you are likely missing the Python "PIL" module. ImportError: No module named _imaging
INFO 2011-02-24 11:11:09,726 dev_appserver_main.py:507] Running application rubete2010survey on port 9999: http://localhost:9999
when i go to http://localhost:9999; the page is not found;
the app.yaml is:
application: rubete2010survey
version: 1
runtime: python
api_version: 1
handlers:
- url: /.*
script: main.py
the main.py is:
print 'Content-Type: text/plain'
print ''
print 'Hello, world!'
they are in the same folder; test/src
what's the problem?
try with:
http://127.0.0.1:9999
in case it works, add localhost to your hosts file.
pip install pil
pip install ssl

Resources