While trying to appcfg.py update myProject, my endpoints failed to update. Here is part of the trace:
09:36 PM Failed to update Endpoints configuration. The app returned an error when the Google Cloud Endpoints server attempted to communicate with it.
09:36 PM See the deployment troubleshooting documentation for more information: https://developers.google.com/appengine/docs/python/endpoints/test_deploy#troubleshooting_a_deployment_failure
09:36 PM Ignoring Endpoints failure and proceeding with update.
I tried to check the logs at http://localhost:8080/_ah/spi/BackendService.getApiConfigs, but terminal produces the following error:
#endpoints.api(name='EventsAPI', version='v1')
AttributeError: 'module' object has no attribute 'api'
INFO 2016-03-18 02:01:37,742 module.py:787] default: "GET /_ah/spi/BackendService.getApiConfigs HTTP/1.1" 500 -
Here is my code:
import endpoints
from protorpc import messages
from protorpc import message_types
from protorpc import remote
package = 'Events'
#endpoints.api(name='EventsAPI', version='v1')
class EventsAPI(remote.Service):
# insert lots of endpoint methods
APPLICATION = endpoints.api_server([EventsAPI])
I am following this tutorial. Where did I go wrong?
There is a problem with the endpoints' name. The name EventsAPI is invalid; changing it to eventsapi fixed this issue.
For reference, as outlined in the endpoint definitions.
The name value: Must begin with lowercase.
Related
I try to use the PahoEndpointBuilder
PahoEndpointBuilder endpoint = paho (topic).brokerUrl (brokerUrl);
but starting the route based on that endpoint always leads to an exception.
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: paho:myTestTopicMandant9?brokerUrl=tcp%3A%2F%2Flocalhost%3A1883 due to: There are 1 parameters that couldn't be set on the endpoint. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{brokerUrl=tcp://localhost:1883}]
at org.apache.camel.support.DefaultComponent.validateParameters(DefaultComponent.java:351)
at org.apache.camel.support.DefaultComponent.createEndpoint(DefaultComponent.java:169)
at org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:952)
Is this a bug?
Its a bug in Camel 3.2 that has been logged in JIRA: https://issues.apache.org/jira/browse/CAMEL-14921
I am using pike release of openstack and ceilometer version 2.9.0 and keystone v3.
$ceilometer meter-list gives HTTP 404 Not Found error
$gnocchi metric list --> HTTP 401
$openstack metric list ---> lists the meters (works) . However in yaml file(for autoscaling) I am unable to get metrics using type OS:Ceilometer::Alarm
How to go about it, please guide. Is there any workaround for the issue I am facing?
I have a spark (version 2.2.0) cluster with 7 nodes and url spark://master:7077. I setup Apache Zeppelin 0.7.2 on the master node using the following configuration:
zeppelin.env.sh
export JAVA_HOME=/usr/local/java/jdk1.8.0_144
export SPARK_HOME=/usr/local/spark-2.2.0
export MASTER=spark://master:7077
export ZEPPELIN_PORT=8082
In zeppelin-site.xml I changed zeppelin.server.port from 8080 to 8082, also tried with other ports like 8090, 8091.
After starting zeppelin when I try to access web UI using master:8082 I got the following error but zeppelin status shows it is running:
HTTP ERROR: 500
Problem accessing /. Reason: javax.servlet.HttpServletRequest.isAsyncStarted()Z
I checked the logs and found that java.lang.NoSuchMethodError:javax.servlet.HttpServletRequest.isAsyncStarted()Z
I am trying to use Google Cloud Storage from GAE and all works fine when deployed. I am however unable to get the storage to work on the development server that runs on Google Cloud Shell.
I am using the cloudstorage API and my understanding it that dev_appserver should access same buckets as the deployed application. For me working with local data would be fine as well.
The development server is invoked by dev_appserver.py .
I have played around with the non-documented default_gcs_bucket_name flag but no luck.
I have set he cloud shell to work with the correct project using gcloud init. I have also tried to use the new google.cloud.storage API without luck.
The same error as referenced below is triggered if I run the sample provided here: App Engine and Google Cloud Storage Sample.
Anyone?
Edit: I get the same error regardless of whether I supply a valid or an invalid bucket name.
app.yaml
runtime: python27
api_version: 1
threadsafe: true
builtins:
- remote_api: on
handlers:
- url: /.*
script: main.app
main.py
import logging
import cloudstorage as gcs
import webapp2
from google.appengine.api import app_identity
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
bucket_name = "xxxx-xxxxxx.appspot.com"
stats = gcs.listbucket('/'+bucket_name)
for stat in stats:
self.response.write(repr(stat) + '')
app = webapp2.WSGIApplication([
('/', MainPage),
], debug=True)
Log
INFO 2017-06-07 20:36:42,068 devappserver2.py:116] Skipping SDK update check.
INFO 2017-06-07 20:36:42,105 api_server.py:297] Starting API server at: http://0.0.0.0:38829
INFO 2017-06-07 20:36:42,110 dispatcher.py:209] Starting module "default" running at: http://0.0.0.0:8080
INFO 2017-06-07 20:36:42,111 admin_server.py:116] Starting admin server at: http://0.0.0.0:8000
ERROR 2017-06-07 20:36:54,836 api_server.py:374] Exception while handling service_name: "app_identity_service"
method: "GetAccessToken"
request: "\n7https://www.googleapis.com/auth/devstorage.full_control"
request_id: "QBrGUwjoJT"
Traceback (most recent call last):
File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 349, in _handle_POST
api_response = _execute_request(request).Encode()
File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 225, in _execute_request
make_request()
File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 220, in make_request
request_id)
File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/api/apiproxy_stub.py", line 131, in MakeSyncCall
method(request, response)
File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/api/app_identity/app_identity_defaultcredentialsbased_stub.py", line 195, in _Dynamic_GetAccessToken
'expires': now + token.expires_in,
TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'
WARNING 2017-06-07 20:36:54,838 tasklets.py:468] suspended generator _make_token_async(rest_api.py:55) raised RuntimeError(TypeError("unsupported operand type(s) for +: 'int' and 'NoneType'",))
WARNING 2017-06-07 20:36:54,839 tasklets.py:468] suspended generator get_token_async(rest_api.py:224) raised RuntimeError(TypeError("unsupported operand type(s) for +: 'int' and 'NoneType'",))
WARNING 2017-06-07 20:36:54,839 tasklets.py:468] suspended generator urlfetch_async(rest_api.py:259) raised RuntimeError(TypeError("unsupported operand type(s) for +: 'int' and 'NoneType'",))
WARNING 2017-06-07 20:36:54,839 tasklets.py:468] suspended generator run(api_utils.py:164) raised RuntimeError(TypeError("unsupported operand type(s) for +: 'int' and 'NoneType'",))
WARNING 2017-06-07 20:36:54,839 tasklets.py:468] suspended generator do_request_async(rest_api.py:198) raised RuntimeError(TypeError("unsupported operand type(s) for +: 'int' and 'NoneType'",))
WARNING 2017-06-07 20:36:54,839 tasklets.py:468] suspended generator do_request_async(storage_api.py:137) raised RuntimeError(TypeError("unsupported operand type(s) for +: 'int' and 'NoneType'",))
Follow the instructions available in How the Application Default Credentials work (condition 1.)
It involves setting GOOGLE_APPLICATION_CREDENTIALS env variable to point to a valid json credentials file.
For these tests, I just created a new one selecting App Engine default service account:
...and it worked beautifully.
According to How the Application Default Credentials work running gcloud auth application-default login (condition 2.) should also solve the issue but I have not been able to make it work on Cloud Shell, it fails with the same "access token related" error :-(
dev_appserver.py uses configurations set in your local environment. Make sure the configs set on gcloud init is also correct for deploying to production.
To set Cloud Storage account permissions, go to Cloud Console then:
Storage > Browser > Right Button of your bucket > Edit bucket permissions
Add your account as Storage Admin or the likes.
Make sure you're logged in and have authorized the default service credentials.
% gcloud auth login
% gcloud auth application-default login
I'm currently porting my GAE app to Python 2.7 and have come across some exciting things that I've slowly been able to figure out one at a time (Hello, aliased simplejson library!). However, I'm currently at a loss to explain this particular issue.
Whenever I navigate to the Admin Console (http://localhost:8080/_ah/admin), I get a 404 page. This is strange in itself (This was working just fine before), but it also isn't my custom 404 page. This makes me think this is based on the built-in handlers, but I'm not sure what could be the cause.
Other fun facts:
There's no attempts to handle /_ah/.* in my app.yaml or elsewhere
Nothing has changed in my app.yaml aside from the usual script-to-WSGI handler stuff
No usage of Federated Logins
Over time I've turned on almost all of the builtins
The app deploys correctly and without issue
I'm using the GAE Launcher on OSX (Minor, but it does have some odd quirks about it)
Update
It's probably easier just to show the console logs of what is coming out. This is after the app has fully started and I have attempted to navigate to the admin page twice (The IO Error is cute, and only happens the initial time):
[Master] [dev_appserver_multiprocess.py:650] INFO Running application mygaeapp on port 8081: http://localhost:8081
[Master] [dev_appserver_multiprocess.py:652] INFO Admin console is available at: http://localhost:8081/_ah/admin
[Master] [dev_appserver_multiprocess.py:901] DEBUG balancer to port 9000
[App Instance] [0] [py_zipimport.py:139] WARNING Can't open zipfile /Library/Python/2.7/site-packages/slimmer-0.1.30-py2.7.egg: IOError: [Errno 13] file not accessible: '/Library/Python/2.7/site-packages/slimmer-0.1.30-py2.7.egg'
[App Instance] [0] [py_zipimport.py:139] WARNING Can't open zipfile /Library/Python/2.7/site-packages/NoseGAE-0.2.0-py2.7.egg: IOError: [Errno 13] file not accessible: '/Library/Python/2.7/site-packages/NoseGAE-0.2.0-py2.7.egg'
[App Instance] [0] [recording.py:372] INFO Saved; key: __appstats__:012400, part: 67 bytes, full: 8780 bytes, overhead: 0.000 + 0.007; link: http://localhost:8081/_ah/stats/details?time=1331638312442
[App Instance] [0] [dev_appserver.py:2865] INFO "GET /_ah/admin HTTP/1.1" 404 -
[Master] [dev_appserver_multiprocess.py:901] DEBUG balancer to port 9000
[App Instance] [0] [recording.py:372] INFO Saved; key: __appstats__:020100, part: 67 bytes, full: 9196 bytes, overhead: 0.000 + 0.007; link: http://localhost:8081/_ah/stats/details?time=1331638320129
[App Instance] [0] [dev_appserver.py:2865] INFO "GET /_ah/admin HTTP/1.1" 404 -
[Master] [dev_appserver_multiprocess.py:901] DEBUG balancer to port 9000
In case you found this answer and you're using App Engine SDK 1.7.6 or higher, the default URL has changed from localhost:8080/_ah/admin to localhost:8000.
So I finally tracked this down to something that works perfectly fine in Python 2.5, but breaks on Python 2.7 with dev_appserver only.
To turn maintenance mode on and off, we reassign the routes in the WSGI instance to point to a new set of URLs by changing the app.router field directly. Disabling this code path by checking the app version allows /_ah/admin to work correctly.
I had the same problem due to the fact that I defined a URL filter in my web.xml file:
<filter>
<filter-name>filter</filter-name>
<filter-class>com.example.MyFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
The filter class, MyFilter, has a doFilter method as below:
#Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
String path = req.getRequestURI().substring(req.getContextPath().length());
if (path.equals("/")) { // Welcome path
request.getRequestDispatcher("/res/index").forward(request, response);
} else if (path.startsWith("/static") || path.startsWith("/_ah")) {
// Static content or internal and admin stuff
chain.doFilter(request, response); // Goes to default servlet.
} else { // Jersey servlet controller
request.getRequestDispatcher("/res" + path).forward(request, response);
}
}
The part in the code above reading || path.startsWith("/_ah") solved my problem, because the filter must allow paths starting with /_ah to go through unchanged.
I needed the filter so that Jersey could work without all my REST paths being prepended with /res or whatever is specified in web.xml.