1
votes

I am just doing a standard intro tutorial to the Google Data Store and I am running locally on Ubuntu. It was working at first but for some reasons it stopped working and always show that follow error.

This is what I get if I try to access the data or when I go to http://localhost:8000/datastore

I tried deleting Google App Engine folder and redownloaded it and tried the command for clearing the data. I ran out of ideas. Have anyone encountered this problem?

Internal Server Error

The server has either erred or is incapable of performing the requested operation.

Traceback (most recent call last):
  File "/home/matthew/Project/google_appengine/lib/webapp2-2.5.1/webapp2.py", line 1536, in __call__
    rv = self.handle_exception(request, response, e)
  File "/home/matthew/Project/google_appengine/lib/webapp2-2.5.1/webapp2.py", line 1530, in __call__
    rv = self.router.dispatch(request, response)
  File "/home/matthew/Project/google_appengine/lib/webapp2-2.5.1/webapp2.py", line 1278, in default_dispatcher
    return route.handler_adapter(request, response)
  File "/home/matthew/Project/google_appengine/lib/webapp2-2.5.1/webapp2.py", line 1102, in __call__
    return handler.dispatch()
  File "/home/matthew/Project/google_appengine/google/appengine/tools/devappserver2/admin/admin_request_handler.py", line 96, in dispatch
    super(AdminRequestHandler, self).dispatch()
  File "/home/matthew/Project/google_appengine/lib/webapp2-2.5.1/webapp2.py", line 572, in dispatch
    return self.handle_exception(e, self.app.debug)
  File "/home/matthew/Project/google_appengine/lib/webapp2-2.5.1/webapp2.py", line 570, in dispatch
    return method(*args, **kwargs)
  File "/home/matthew/Project/google_appengine/google/appengine/tools/devappserver2/admin/datastore_viewer.py", line 667, in get
    kinds = self._get_kinds(namespace)
  File "/home/matthew/Project/google_appengine/google/appengine/tools/devappserver2/admin/datastore_viewer.py", line 603, in _get_kinds
    return sorted([x.kind_name for x in q.run()])
  File "/home/matthew/Project/google_appengine/google/appengine/ext/db/__init__.py", line 2330, in next
    return self.__model_class.from_entity(self.__iterator.next())
  File "/home/matthew/Project/google_appengine/google/appengine/datastore/datastore_query.py", line 3321, in next
    next_batch = self.__batcher.next_batch(Batcher.AT_LEAST_OFFSET)
  File "/home/matthew/Project/google_appengine/google/appengine/datastore/datastore_query.py", line 3207, in next_batch
    batch = self.__next_batch.get_result()
  File "/home/matthew/Project/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 613, in get_result
    return self.__get_result_hook(self)
  File "/home/matthew/Project/google_appengine/google/appengine/datastore/datastore_query.py", line 2906, in __query_result_hook
    self._batch_shared.conn.check_rpc_success(rpc)
  File "/home/matthew/Project/google_appengine/google/appengine/datastore/datastore_rpc.py", line 1371, in check_rpc_success
    rpc.check_success()
  File "/home/matthew/Project/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 579, in check_success
    self.__rpc.CheckSuccess()
  File "/home/matthew/Project/google_appengine/google/appengine/api/apiproxy_rpc.py", line 157, in _WaitImpl
    self.request, self.response)
  File "/home/matthew/Project/google_appengine/google/appengine/datastore/datastore_sqlite_stub.py", line 971, in MakeSyncCall
    response, request_id)
  File "/home/matthew/Project/google_appengine/google/appengine/api/apiproxy_stub.py", line 131, in MakeSyncCall
    method(request, response)
  File "/home/matthew/Project/google_appengine/google/appengine/datastore/datastore_stub_util.py", line 2962, in UpdateIndexesWrapper
    self._SetupIndexes()
  File "/home/matthew/Project/google_appengine/google/appengine/datastore/datastore_stub_util.py", line 3438, in _SetupIndexes
    index_defs = datastore_index.ParseIndexDefinitions(index_text)
  File "/home/matthew/Project/google_appengine/google/appengine/datastore/datastore_index.py", line 208, in ParseIndexDefinitions
    return yaml_object.BuildSingleObject(IndexDefinitions, document)
  File "/home/matthew/Project/google_appengine/google/appengine/api/yaml_object.py", line 321, in BuildSingleObject
    definitions = BuildObjects(default_class, stream, loader)
  File "/home/matthew/Project/google_appengine/google/appengine/api/yaml_object.py", line 304, in BuildObjects
    listener.Parse(stream, loader)
  File "/home/matthew/Project/google_appengine/google/appengine/api/yaml_listener.py", line 227, in Parse
    self._HandleEvents(self._GenerateEventParameters(stream, loader_class))
  File "/home/matthew/Project/google_appengine/google/appengine/api/yaml_listener.py", line 178, in _HandleEvents
    raise yaml_errors.EventError(e, event_object)
EventError: Unable to assign value '5770237022568448' to attribute 'name':
Value 5770237022568448 for name is not of the expected type str
  in "<string>", line 17, column 11:
      - name: 5770237022568448

Update with more information

This is what I see when I tried it on the interactive console: enter image description here This is what I see when I click Datastore Viewer, Datastore Indexes, or Blobstore viewer.

enter image description here

2
The error suggests a mismatch between a property type (string) and its value(5770237022568448, which looks like an entity key, which is a long). Which could indicate an accidental use of an entity's key instead of its value, or of its key ID instead of its key. Can also indicate an incompatible change in an entity models while entities of that model exist in the DB (string vs int/long). Or using a reserved property name. You need to show some code, at least the one creating and querying/accessing the entities related to the operation for which you get the error and their models.Dan Cornilescu
I might have done something like using the Key ID instead of the Key. However, I don't have any query right now and I just have a model and I saw the above error when I went to localhost:8000/datastore. class Story(db.Model): title = db.StringProperty() body = db.TextProperty() created = db.DateTimeProperty(auto_now_add=True)tuzzer
I am wondering if there's a away to just reset the whole datastore. I tried deleting the entire Google App Engine folder and downloading a new one. But that didn't work.tuzzer
You can reset your local datastore completely using the --clear_datastore option (run dev_appserver.py --help for the exact syntax)Dan Cornilescu
correction on my earlier comment: 5770237022568448 looks like an automatically assigned key ID, not key...Dan Cornilescu

2 Answers

3
votes

I figured out how to fix this.

I realized that there is an "index.yaml" in my project folder and this was what inside it.

indexes:

# AUTOGENERATED

# This index.yaml is automatically updated whenever the dev_appserver
# detects that a new type of query is run.  If you want to manage the
# index.yaml file manually, remove the above marker line (the line
# saying "# AUTOGENERATED").  If you want to manage some indexes
# manually, move them above the marker line.  The index.yaml file is
# automatically uploaded to the admin console when you next deploy
# your application using appcfg.py.

- kind: Post
  ancestor: yes
  properties:
  - name: 5770237022568448
    direction: desc

At some point, I probably entered an incorrect query that got logged there. This caused errors in my datastore. Deleting this file solves the problem.

I am not sure what kind of query I made to caused this to happen. It is kind of worrying that an incorrect query can corrupt the datebase permanently though.

0
votes

If you want to clear your Datastore data, you can go to your app's datastore admin (cloud console > Datastore > Admin) and delete your entities from there. That could fix this issue if in fact you had changed your data model after some entities were already created, resulting in incompatible property types.