FIWARE Orion负载过高时转发Update请求超时及实体未找到问题
FIWARE Orion设备配置Update请求报错排查
问题场景
尝试使用单组件FIWARE Orion配置设备并回传驱动命令,执行update请求后触发错误。
执行的Update请求
curl -iX POST \ 'http://orion:1024/v2/op/update' \ -H 'Content-Type: application/json' \ -H 'fiware-service: agriculture' \ -H 'fiware-servicepath: /agriculture' \ -d '{ "actionType":"update", "entities":[{"motor":{"type":"command","value":{"requestTime":"2023-11-17T06:50:00.060", "payload":{"motor_status":"on","requestTimestamp":"2023-11-17T18:49:59.091", "motor_status":"on"},"transactionId":"xxxx-87a5-4xxx2-xxx-xxxxxxx"}},"id":"urn:ngsi-ld:test:test1","type":"test"}]} '
返回的错误响应
{"error":"NotFound","description":"The requested entity has not been found. Check type and id"}
Orion日志记录
fiware-orion Starting transaction to http://orion:1024/v2/op/update
fiware-orion | ERROR@10:16:34 postUpdateContext.cpp[190]:Runtime Error (error 'Timeout was reached' forwarding 'Update' to providing application) fiware-orion | INFO@10:16:34 logMsg.h[1874]: Transaction ended
排查与解决步骤
确认目标实体是否存在
错误提示明确实体urn:ngsi-ld:test:test1(类型test)在指定的fiware-service和fiware-servicepath下不存在。先通过查询请求验证实体状态:curl -X GET \ 'http://orion:1024/v2/entities/urn:ngsi-ld:test:test1' \ -H 'fiware-service: agriculture' \ -H 'fiware-servicepath: /agriculture'若实体不存在,需先通过
POST /v2/entities接口创建该实体,再执行update操作。修正请求JSON格式问题
请求的payload字段中重复出现motor_status":"on",属于冗余键,可能导致Orion解析异常。修正后的payload应改为:"payload":{"motor_status":"on","requestTimestamp":"2023-11-17T18:49:59.091"}排查转发超时问题
日志中Timeout was reached说明Orion向关联的提供应用(如IoT Agent)转发请求时超时:- 确认IoT Agent已正确注册到Orion,且服务路径、实体类型完全匹配;
- 检查Orion与IoT Agent的网络连通性,可从Orion容器内ping IoT Agent地址验证;
- 若为IoT Agent处理速度问题,可调整Orion的
-forwardingTimeout参数(默认10秒)延长超时时间。
验证NGSI版本兼容性
请求实体ID使用了NGSI-LD格式的urn:ngsi-ld:前缀,但调用的是Orion的NGSI-v2接口(/v2/op/update)。需确认Orion是否配置支持NGSI-LD,或调整实体ID为NGSI-v2格式(如改为urn:test:test1)。
内容的提问来源于stack exchange,提问作者Satheeshkumar Govindaraj
相关产品推荐
相关产品推荐

