Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

ProtoRPC type miss match #30

Open
protodmorgan opened this issue Mar 9, 2018 · 0 comments
Open

ProtoRPC type miss match #30

protodmorgan opened this issue Mar 9, 2018 · 0 comments

Comments

@protodmorgan
Copy link

I'm using Google NDB, to do a post put hook to generate a search Index. However, I am receiving the error below when it attempts to generate the document. I'm not sure why I am getting this as all my types. All the types are already in Unicode when checking the type. Unsure if this should be here or elsewhere...

GAE Standard, Py27

My Model:

class DirectionModel(ndb.Model):
    created_at = ndb.DateTimeProperty(auto_now_add=True)
    deviceId = ndb.StringProperty()
    deviceName = ndb.StringProperty()
    updated_at = ndb.DateTimeProperty(auto_now=True)
    settings = ndb.StringProperty(indexed=False)
    keywords = ndb.StringProperty(repeated=True)
    testId = ndb.StringProperty()

    def _post_put_hook(self, future):
        doc = search.Document(doc_id=self.key.id(), fields=[
            search.TextField(name='deviceId', value=self.deviceId),
            search.TextField(name='deviceName', value=self.deviceName),
            search.TextField(name='settings', value=self.settings),
            search.TextField(name='testId', value=self.testId)
        ])
        search.Index('cookingDirections').put(doc)
Encountered unexpected error from ProtoRPC method implementation: TypeError (coercing to Unicode: need string or buffer, long found) (/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/third_party/protorpc-1.0/protorpc/wsgi/service.py:191)
Traceback (most recent call last):
  File "/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/third_party/protorpc-1.0/protorpc/wsgi/service.py", line 181, in protorpc_service_app
    response = method(instance, request)
  File "/base/data/home/apps/s~hyperwave-168417/cookingdirections:20180309t143359.408189414954364822/lib/endpoints/api_config.py", line 1272, in invoke_remote
    return remote_method(service_instance, request)
  File "/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/third_party/protorpc-1.0/protorpc/remote.py", line 414, in invoke_remote_method
    response = method(service_instance, request)
  File "/base/data/home/apps/s~hyperwave-168417/cookingdirections:20180309t143359.408189414954364822/main.py", line 135, in create
    keywords=keywords.split(',')).put()
  File "/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/1/google/appengine/ext/ndb/model.py", line 3458, in _put
    return self._put_async(**ctx_options).get_result()
  File "/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 383, in get_result
    self.check_success()
  File "/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 378, in check_success
    self.wait()
  File "/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 362, in wait
    if not ev.run1():
  File "/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/1/google/appengine/ext/ndb/eventloop.py", line 268, in run1
    delay = self.run0()
  File "/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/1/google/appengine/ext/ndb/eventloop.py", line 230, in run0
    callback(*args, **kwds)
  File "/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 533, in _on_future_completion
    self._help_tasklet_along(ns, ds_conn, gen, val)
  File "/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 444, in _help_tasklet_along
    self.set_result(result)
  File "/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 327, in set_result
    callback(*args, **kwds)
  File "/base/data/home/apps/s~hyperwave-168417/cookingdirections:20180309t143359.408189414954364822/main.py", line 59, in _post_put_hook
    search.TextField(name='testId', value=unicode(self.testId))
  File "/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/1/google/appengine/api/search/search.py", line 1926, in __init__
    doc_id = _ConvertToUnicode(doc_id)
  File "/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/1/google/appengine/api/search/search.py", line 247, in _ConvertToUnicode
    return unicode(some_string, 'utf-8')
TypeError: coercing to Unicode: need string or buffer, long found
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant