无法将数据插入本地Google App Engine数据存储区 [英] fail to insert data into local Google App Engine datastore

查看:118
本文介绍了无法将数据插入本地Google App Engine数据存储区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循

解决方案

。我最初经历了相同的步骤并得到了相同的错误,但输出中值得注意的是条目 INFO client.py:669 access_token已过期

  MobileAssistant-Data> appcfg.py upload_data --config_file bulkloader.yaml --url = http:// localhost:8080 / remote_api --filename places.csv --kind =地点-e myEmailAddress@gmail.com 
上午05:12上传数据记录。
[INFO]记录到bulkloader-log-20151112.171238
[INFO]限制传输:
[INFO]带宽:250000字节/秒
[INFO] HTTP连接数:8 /秒
[INFO]实体插入/取出/改性:20 /第二
[INFO]批量大小:10
2015年11月12日17:12:38466 INFO client.py:669是的access_token过期。现在:2015-11-12 22:12:38.466000,token_expiry:2015-11-06 01:33:21
错误302:---开始服务器输出---

这看起来有点像 issue 我在远程API处理程序中看到 ClientLogin已被弃用(但在Python SDK中)。为了测试,我编辑了build.gradle以使用最新的SDK版本(1.9.18中的1.9.28)并再次运行它:

  MobileAssistant-数据与GT; appcfg.py upload_data --config_file bulkloader.yaml --url = http:// localhost:8080 / remote_api --filename places.csv --kind =地点-e myEmailAddress@gmail.com 
上午05:16上传数据记录。
[INFO]记录到bulkloader-log-20151112.171615
[INFO]限制传输:
[INFO]带宽:250000字节/秒
[INFO] HTTP连接数:8 /秒
[INFO]实体插入/取出/改性:20 /第二
[INFO]批量大小:10
2015年11月12日17:16:15177 INFO client.py:669是的access_token过期。现在:2015-11-12 22:16:15.177000,token_expiry:2015-11-06 01:33:21
2015-11-12 17:16:15,565 INFO client.py:669 access_token已过期。现在:2015-11-12 22:16:15.565000,token_expiry:2015-11-06 01:33:21
2015-11-12 17:16:15,573 INFO client.py:571刷新原因401 (尝试1/2)
2015-11-12 17:16:15,575信息client.py:797刷新access_token
2015-11-12 17:16:16,039信息client.py:571刷新到期到401(尝试2/2)
2015-11-12 17:16:16,040 INFO client.py:797刷新access_token
...(无限)

此输出现在完全反映了Python Remote API问题。因此,似乎Java Remote API存在相同的问题(auth检查未正确更新为使用新的auth方案)。



Python中的解决方法是手动编辑SDK源代码并删除验证检查。我怀疑Java SDK也需要类似的黑客攻击。它不是那么简单,因为SDK需要从源代码重建。



如果我遇到其他问题,我会用我的发现更新这个答案。请注意,这对部署的应用程序来说应该是完美无缺的 - 它只是受影响的开发服务器。



更新: strong>



罪魁祸首是管理员登入 COM /谷歌/ apphosting / utils的/ remoteapi / RemoteApiServlet.java 与在Python同样的问题上面提到的SDK。不幸的是,你不能简单地从源代码重建SDK,因为build.xml中的构建目标只包含'jsr107cache',其余的构建都是由预生成的二进制文件完成的。看起来我们不得不等待,直到这个问题在未来版本中得到解决,但现在我会更新公共bug。



现在我建议坚持到文档并仅使用部署的用于remote_api上传的应用程序版本。


I am following the example from Google's Mobile Shopping Assistant sample which asks me to import data according to this link.

I tried the steps according to the example (all the sample codes are vanilla, i didn't change any thing except to fix the warning to use the latest Gradle build version)

I believe that I am missing an essential step that is not stated in the example. Can someone provide some insights into which steps I did wrongly?

the following are the steps i did

  1. start local googleAppEngine app "backend"
  2. ran cmd " appcfg.py upload_data --config_file bulkloader.yaml --url=http ://localhost:8080/remote_api --filename places.csv --kind=Place -e myEmailAddress@gmail.com".

    This command is supposed to insert 2 rows into the datastore (places.csv contains two entries)

  3. this gave me the following readout

10:07 AM Uploading data records.

[INFO    ] Logging to bulkloader-log-20151020.100728

[INFO    ] Throttling transfers:

[INFO    ] Bandwidth: 250000 bytes/second

[INFO    ] HTTP connections: 8/second

[INFO    ] Entities inserted/fetched/modified: 20/second

[INFO    ] Batch Size: 10

Error 302: --- begin server output ---

--- end server output ---

  1. I then go to "http://localhost:8080/admin/buildsearchindex" which displays "MaintenanceTasks completed."

  2. Next I go to "http://localhost:8080/_ah/admin" but it displays

Datastore has no entities in the Empty namespace. You need to add data

programatically before you can use this tool to view and edit it.

解决方案

So here is what I found through testing. I went through the same steps initially and got the same error, but what is worthy of note in the output is the entry INFO client.py:669 access_token is expired:

MobileAssistant-Data> appcfg.py upload_data --config_file bulkloader.yaml --url=http://localhost:8080/remote_api --filename places.csv --kind=Place -e myEmailAddress@gmail.com
05:12 PM Uploading data records.
[INFO    ] Logging to bulkloader-log-20151112.171238
[INFO    ] Throttling transfers:
[INFO    ] Bandwidth: 250000 bytes/second
[INFO    ] HTTP connections: 8/second
[INFO    ] Entities inserted/fetched/modified: 20/second
[INFO    ] Batch Size: 10
2015-11-12 17:12:38,466 INFO client.py:669 access_token is expired. Now: 2015-11-12 22:12:38.466000, token_expiry: 2015-11-06 01:33:21
Error 302: --- begin server output ---

This looked somewhat like an issue I saw in the Remote API handler for the dev server that surfaced after ClientLogin was deprecated (but in the Python SDK). Just to test I edited the build.gradle to use the latest SDK version (1.9.28 from 1.9.18) and ran it again:

MobileAssistant-Data> appcfg.py upload_data --config_file bulkloader.yaml --url=http://localhost:8080/remote_api --filename places.csv --kind=Place -e myEmailAddress@gmail.com
05:16 PM Uploading data records.
[INFO    ] Logging to bulkloader-log-20151112.171615
[INFO    ] Throttling transfers:
[INFO    ] Bandwidth: 250000 bytes/second
[INFO    ] HTTP connections: 8/second
[INFO    ] Entities inserted/fetched/modified: 20/second
[INFO    ] Batch Size: 10
2015-11-12 17:16:15,177 INFO client.py:669 access_token is expired. Now: 2015-11-12 22:16:15.177000, token_expiry: 2015-11-06 01:33:21
2015-11-12 17:16:15,565 INFO client.py:669 access_token is expired. Now: 2015-11-12 22:16:15.565000, token_expiry: 2015-11-06 01:33:21
2015-11-12 17:16:15,573 INFO client.py:571 Refreshing due to a 401 (attempt 1/2)
2015-11-12 17:16:15,575 INFO client.py:797 Refreshing access_token
2015-11-12 17:16:16,039 INFO client.py:571 Refreshing due to a 401 (attempt 2/2)
2015-11-12 17:16:16,040 INFO client.py:797 Refreshing access_token
... (ad infinitum)

This output now mirrors the Python Remote API issue exactly. So it seems that the same issue exists with the Java Remote API (the auth check has not been properly updated to use the new auth scheme).

The workaround in Python was to manually edit the SDK source code and stub out the auth check. I suspect a similar hack would be necessary for the Java SDK. It's not as straightforward though as the SDK would need to be rebuilt from source.

If I come across anything else I will update this answer with my findings. Note that this should work perfectly fine with a deployed application - it's only the dev server that is affected.

Update:

The culprit is the admin check in com/google/apphosting/utils/remoteapi/RemoteApiServlet.java as with the same issue in the Python SDK noted above. Unfortunately you cannot trivially rebuild the SDK from source, as the build target in build.xml only includes 'jsr107cache' and the rest of the build is done from pre-generated binaries. It looks like we'll have to just wait until this is fixed in a future release, but for now I will update the public bug.

For now I would recommend sticking to the documentation and only using the deployed app version for remote_api uploads.

这篇关于无法将数据插入本地Google App Engine数据存储区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆