[Question] 用户(User)API ,创建用户报错 POST http://localhost:8080/graphs/hugegraph/auth/users
Problem Type (问题类型)
None
Before submit
- [x] 我已经确认现有的 Issues 与 FAQ 中没有相同 / 重复问题 (I have confirmed and searched that there are no similar problems in the historical issue and documents)
Environment (环境信息)
- Server Version: 1.5.0 (Apache Release Version)
- Backend: RocksDB 3nodes, HDD or SSD
- OS: 16 CPUs, 16G RAM,CentOS 7.8
- Data Size: 小图
Your Question (问题描述)
请求URL
curl --location --request POST 'http://192.168.12.57:8081/graphs/hugegraph/auth/users' \
--header 'Authorization: Basic YWRtaW46a2RAMjAyNA==' \
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
--header 'Content-Type: application/json' \
--header 'Accept: */*' \
--header 'Host: 192.168.12.57:8081' \
--header 'Connection: keep-alive' \
--data-raw '{
"user_name": "1481211525",
"user_password": "kd@2024",
"user_phone": "1481211525",
"user_email": "[email protected]"
}'
响应结果
{
"exception": "class java.lang.IllegalStateException",
"message": "Property creator can't be null",
"cause": ""
}
Vertex/Edge example (问题点 / 边数据举例)
Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
这个报错“Property creator can't be null”是因为 HugeGraph 的用户创建流程中,后端要求每个用户实体必须有一个 creator 字段,但目前 API 和后端实现没有自动设置这个字段,导致创建用户时抛出异常。你的请求格式和参数都是正确的,问题出在服务端逻辑。
目前没有官方文档或补丁说明如何绕过或修复这个问题。代码分析显示,creator 字段应该由后端自动赋值(比如当前登录用户),但 HugeGraph 1.5.0 版本在用户创建时没有做这一步,和 group、project 等其他实体的处理方式不同(这些实体会在代码里显式设置 creator 字段)相关代码分析。
临时解决思路:需要在服务端代码中补充逻辑,自动为新建用户设置 creator 字段(比如设置为当前操作用户的用户名或 id)。客户端请求无需也无法直接传递 creator 字段。
如果你有能力修改源码,可以在用户创建相关的后端逻辑(如 UserAPI 或 AuthManager)里补充 creator 字段的赋值。如果只能用官方发布包,目前没有现成的绕过办法。
如需进一步定位或修复建议,可以提供更详细的日志或尝试升级到后续版本(如果有修复)。
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
@imbajin 大佬,救救我救救我
你在想屁吃,救不了一点哈哈哈
嘤嘤嘤嘤嘤,嘤嘤嘤嘤嘤
For this issue, you can try using gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy instead of org.apache.hugegraph.HugeFactory in hugegraph.properties.
Due to the lack of activity, the current issue is marked as stale and will be closed after 20 days, any update will remove the stale label