gae-init / gae-init-upload

Fork of gae-init with Google Cloud Storage
http://upload.gae-init.appspot.com
MIT License
36 stars 15 forks source link

Error Deleting User #23

Open celiomarcos opened 7 years ago

celiomarcos commented 7 years ago

Starting a fresh project, there is a problem when delete a user in Admin

INFO     2017-04-25 00:24:09,046 module.py:806] default: "GET /admin/user/?order=-modified&active=True HTTP/1.1" 200 10054
INFO     2017-04-25 00:24:09,221 module.py:806] default: "GET /p/dev/style/style.css?None.464327711515062959 HTTP/1.1" 304 -
INFO     2017-04-25 00:24:09,231 module.py:806] default: "GET /p/dev/script/script.js?None.464327711515062959 HTTP/1.1" 304 -
INFO     2017-04-25 00:24:09,226 module.py:806] default: "GET /p/dev/script/ext.js?None.464327711515062959 HTTP/1.1" 304 -
INFO     2017-04-25 00:24:09,989 module.py:806] default: "GET /favicon.ico HTTP/1.1" 304 -
WARNING  2017-04-25 00:24:17,286 tasklets.py:468] suspended generator run_to_queue(query.py:969) raised BadRequestError(Only ancestor queries are allowed inside transactions.)
WARNING  2017-04-25 00:24:17,286 tasklets.py:468] suspended generator helper(context.py:890) raised BadRequestError(Only ancestor queries are allowed inside transactions.)
WARNING  2017-04-25 00:24:17,286 tasklets.py:468] suspended generator has_next_async(query.py:1793) raised BadRequestError(Only ancestor queries are allowed inside transactions.)
WARNING  2017-04-25 00:24:17,286 tasklets.py:468] suspended generator _fetch_page_async(query.py:1380) raised BadRequestError(Only ancestor queries are allowed inside transactions.)
WARNING  2017-04-25 00:24:17,290 tasklets.py:468] suspended generator transaction(context.py:1018) raised BadRequestError(Only ancestor queries are allowed inside transactions.)
ERROR    2017-04-25 00:24:17,293 helpers.py:22] Only ancestor queries are allowed inside transactions.
Traceback (most recent call last):
  File "lib/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "lib/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "lib/flask_restful/__init__.py", line 477, in wrapper
    resp = resource(*args, **kwargs)
  File "lib/flask/views.py", line 84, in view
    return self.dispatch_request(*args, **kwargs)
  File "lib/flask_restful/__init__.py", line 587, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/home/celiomarcos/projs/3rds/gae-init-upload/main/auth/auth.py", line 125, in decorated_function
    return f(*args, **kwargs)
  File "/home/celiomarcos/projs/3rds/gae-init-upload/main/api/v1/user.py", line 40, in delete
    delete_user_dbs(user_db_keys)
  File "/home/celiomarcos/google-cloud-sdk/platform/google_appengine/google/appengine/ext/ndb/utils.py", line 197, in inner_wrapper
    return wrapped_decorator(func, args, kwds, **options)
  File "/home/celiomarcos/google-cloud-sdk/platform/google_appengine/google/appengine/ext/ndb/model.py", line 3841, in transactional
    func, args, kwds, **options).get_result()
  File "/home/celiomarcos/google-cloud-sdk/platform/google_appengine/google/appengine/ext/ndb/tasklets.py", line 383, in get_result
    self.check_success()
  File "/home/celiomarcos/google-cloud-sdk/platform/google_appengine/google/appengine/ext/ndb/tasklets.py", line 430, in _help_tasklet_along
    value = gen.send(val)
  File "/home/celiomarcos/google-cloud-sdk/platform/google_appengine/google/appengine/ext/ndb/context.py", line 1014, in transaction
    result = callback()
  File "/home/celiomarcos/google-cloud-sdk/platform/google_appengine/google/appengine/ext/ndb/model.py", line 3849, in <lambda>
    return transaction_async(lambda: func(*args, **kwds), **options)
  File "/home/celiomarcos/projs/3rds/gae-init-upload/main/api/v1/user.py", line 71, in delete_user_dbs
    delete_user_task(user_key)
  File "/home/celiomarcos/projs/3rds/gae-init-upload/main/api/v1/user.py", line 78, in delete_user_task
    cursor=next_cursor,
  File "/home/celiomarcos/projs/3rds/gae-init-upload/main/util.py", line 97, in get_dbs
    limit, start_cursor=cursor, keys_only=keys_only,
  File "/home/celiomarcos/google-cloud-sdk/platform/google_appengine/google/appengine/ext/ndb/utils.py", line 160, in positional_wrapper
    return wrapped(*args, **kwds)
  File "/home/celiomarcos/google-cloud-sdk/platform/google_appengine/google/appengine/ext/ndb/query.py", line 1362, in fetch_page
    return self.fetch_page_async(page_size, **q_options).get_result()
  File "/home/celiomarcos/google-cloud-sdk/platform/google_appengine/google/appengine/ext/ndb/tasklets.py", line 383, in get_result
    self.check_success()
  File "/home/celiomarcos/google-cloud-sdk/platform/google_appengine/google/appengine/ext/ndb/tasklets.py", line 427, in _help_tasklet_along
    value = gen.throw(exc.__class__, exc, tb)
  File "/home/celiomarcos/google-cloud-sdk/platform/google_appengine/google/appengine/ext/ndb/query.py", line 1380, in _fetch_page_async
    while (yield it.has_next_async()):
  File "/home/celiomarcos/google-cloud-sdk/platform/google_appengine/google/appengine/ext/ndb/tasklets.py", line 427, in _help_tasklet_along
    value = gen.throw(exc.__class__, exc, tb)
  File "/home/celiomarcos/google-cloud-sdk/platform/google_appengine/google/appengine/ext/ndb/query.py", line 1793, in has_next_async
    yield self._fut
  File "/home/celiomarcos/google-cloud-sdk/platform/google_appengine/google/appengine/ext/ndb/context.py", line 890, in helper
    batch, i, ent = yield inq.getq()
  File "/home/celiomarcos/google-cloud-sdk/platform/google_appengine/google/appengine/ext/ndb/query.py", line 969, in run_to_queue
    batch = yield rpc
  File "/home/celiomarcos/google-cloud-sdk/platform/google_appengine/google/appengine/ext/ndb/tasklets.py", line 513, in _on_rpc_completion
    result = rpc.get_result()
  File "/home/celiomarcos/google-cloud-sdk/platform/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 613, in get_result
    return self.__get_result_hook(self)
  File "/home/celiomarcos/google-cloud-sdk/platform/google_appengine/google/appengine/datastore/datastore_query.py", line 2906, in __query_result_hook
    self._batch_shared.conn.check_rpc_success(rpc)
  File "/home/celiomarcos/google-cloud-sdk/platform/google_appengine/google/appengine/datastore/datastore_rpc.py", line 1371, in check_rpc_success
    raise _ToDatastoreError(err)
BadRequestError: Only ancestor queries are allowed inside transactions.
WARNING  2017-04-25 00:24:17,347 recording.py:662] Found 1 RPC request(s) without matching response (presumably due to timeouts or other errors)
INFO     2017-04-25 00:24:17,389 recording.py:676] Saved; key: __appstats__:057200, part: 235 bytes, full: 23267 bytes, overhead: 0.001 + 0.042; link: http://127.0.0.1:8080/_ah/stats/details?time=1493079857237
INFO     2017-04-25 00:24:17,413 module.py:806] default: "DELETE /api/v1/admin/user/?user_keys=aghkZXZ-Tm9uZXIRCxIEVXNlchiAgICAgICACQw HTTP/1.1" 500 183

Can someone give me some light where i can start looking to fix this?

lipis commented 7 years ago

I'm guessing you are trying to delete more thing than just a User.. Right?

lipis commented 7 years ago

I just noticed that it's the upload project and not the core one..

celiomarcos commented 7 years ago

yes, just in the upload project

On Apr 29, 2017 11:56, "Lipis" notifications@github.com wrote:

I just noticed that it's the upload project and not the core one..

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gae-init/gae-init-upload/issues/23#issuecomment-298173862, or mute the thread https://github.com/notifications/unsubscribe-auth/AByJ4cO5OvIJzVmIuWvZJHM3qo1EOS29ks5r00-CgaJpZM4NMQ0- .

celiomarcos commented 7 years ago

Is there any expectation of fixing this bug soon? Because without this basic feature, I mean to exclude a registered user even with their uploads, the project becomes practically unusable to production. Was there any temporary fix that can be made? I ask because I would like to use this project as a basis for the new website of an NGO of my city, thanks for your time and congratulations for the gea-init base project, its amazing and very usefull!

lipis commented 7 years ago

I will take a look over the weekend! Quite busy these days with some personal stuff... but you are right! this basic thing should be fixed.. :)

lipis commented 7 years ago

Please check #24 if it works for you.. it might have issues if the user has way too many resources.. It is using a different approach from the previous more messy approach.

celiomarcos commented 7 years ago

Yes it works! But in production, accessing through localhost:000, which is the default when invoking by 'gulp', results in 'CORS header' Access-Control-Allow-Origin 'missing' when uploading a file. I accessed through 127.0.0.1:8080 and everything worked perfect. This fix helped a lot, thanks.

On Thu, Jun 22, 2017 at 7:23 PM, Lipis notifications@github.com wrote:

Please check #24 https://github.com/gae-init/gae-init-upload/pull/24 if it works for you.. it might have issues if the user has way too many resources.. It is using a different approach from the previous more messy approach.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gae-init/gae-init-upload/issues/23#issuecomment-310519327, or mute the thread https://github.com/notifications/unsubscribe-auth/AByJ4esXm02-Fw2JrP719nt7S1IY7vneks5sGulwgaJpZM4NMQ0- .