Warning on post that returns no data

@rigpapa, i have a reactor that calls a POST request on another machine on my network to set some motion detection settings. the POST commands are working just fine, but the reactor is always in a warning state. it seems that the post call does not return anything, so i get this in the event summary:

2020-04-24 22:43:10: Request action: POST http://UID:PASS@10.99.99.99:99/camerasettings
2020-04-24 22:43:10: { dev=155, warning="[string \"--[[...\"]:2561: attempt to get length of local 'respBody' (a number value)", scene="grpql4n78r.true", sceneName="grpql4n78r.true", index=2, event="runscene", group=1 }

Not a huge issue since things are working, but thought iā€™d let you know.

2 Likes

What version of Reactor are you running?

*************************************************** REACTOR LOGIC SUMMARY REPORT ***************************************************
Version: 3.6 config 20070 cdata 20045 ui 20085 pluginDevice 24 LuaXP 1.0.2enh
System: Vera version 1.7.4970 (7.31) on Sercomm G450 ID 36 (Vera Plus); loadtime 1587781248/1587781262; systemReady 1587781267; ALTUI v2.49
Env: Lua 5.1; JSON dkjson 2.5+LPeg; UnsafeLua=nil/true
Local time: 2020-04-26T12:30:11-0400; DST=1; Nags Head, North Carolina United States; formats %d/%m/%Y %H:%M:%S
House mode: plugin 1; system 1; tracking on
Sun data: {ā€œsourceā€:ā€œintā€,ā€œcivdawnā€:1587894468,ā€œnautdawnā€:1587892518,ā€œsunsetā€:1587944687,ā€œnautduskā€:1587948263,ā€œstampā€:2020117,ā€œlatitudeā€:35.858629,ā€œastroduskā€:1587950312,ā€œlongitudeā€:-75.570285,ā€œcivduskā€:1587946313,ā€œastrodawnā€:1587890469,ā€œsunriseā€:1587896095}
Geofence: not running
RS: 1587659811,1587659855,1587660232,1587661032,1587729965,1587731496,1587752372,1587752931,1587766800,1587781262
NS: 0:X,1586816280:U,1586839260:D,946699020:U

What HTTP status is it returning? Thatā€™s in the Events section of the logic summary.

in the logic summary i donā€™t see a status. I see these:

2020-04-24 22:21:03: Sensor update starting
2020-04-24 22:21:03: Changing RS tripped state to false
2020-04-24 22:21:03: Sensor update completed; 0.219s
2020-04-24 22:43:10: { dev=155, name=ā€œReactor Masterā€, var=ā€œHouseModeā€, device=24, event=ā€œdevicewatchā€ }
2020-04-24 22:43:10: Sensor update starting
2020-04-24 22:43:10: Condition cond0 test state changed from false to true
2020-04-24 22:43:10: Condition cond0 evaluation state changed from false to true
2020-04-24 22:43:10: Group Night test state changed from false to true
2020-04-24 22:43:10: Group Night evaluation state changed from false to true
2020-04-24 22:43:10: Launching Night.true activity
2020-04-24 22:43:10: Launching scene/activity grpql4n78r.true
2020-04-24 22:43:10: Starting ā€œgrpql4n78r.trueā€ group 1
2020-04-24 22:43:10: Request action: POST http://UID:PASS@10.99.99.99:99/camerasettings
2020-04-24 22:43:10: { dev=155, warning=ā€œ[string "ā€“[[ā€¦"]:2561: attempt to get length of local ā€˜respBodyā€™ (a number value)ā€, scene=ā€œgrpql4n78r.trueā€, sceneName=ā€œgrpql4n78r.trueā€, index=2, event=ā€œrunsceneā€, group=1 }
2020-04-24 22:43:10: Activity ā€œgrpql4n78r.trueā€ finished

In the events log i see this:

|50|04/27/20 8:09:15.542|luup_log:24: Reactor: "Night Mode" (#155) Performing "HTTP Request" ("grpql4n78r.true" group 1 index 2) <0x7721f320>|
|50|04/27/20 8:09:15.544|luup_log:24: Reactor: "Night Mode" (#155) request action: "POST" "http://admin:SILOcams1@10.30.10.110:10023/camerasettings" <0x7721f320>|
|50|04/27/20 8:09:15.545|luup_log:24: Reactor: Request headers: { Content-Length=52, Content-Type="application/x-www-form-urlencoded" } <0x7721f320>|
|50|04/27/20 8:09:15.546|luup_log:24: Reactor: Request body: cameraNum=0&aThresholdH=0&mcThresholdH=0&action=save <0x7721f320>|
|02|04/27/20 8:09:15.599|luup_log:24: Reactor: Request 1 303 returned [{ connection="Keep-Alive", keep-alive="timeout=20, max=100", content-length="0", ss-uuid="QP8340RRZE7PHKNyQrrK", location="index.html" }, "HTTP/1.1 303 OK", nil, nil] <0x7721f320>|
|02|04/27/20 8:09:15.600|luup_log:24: Reactor: Request action failed: [string "--[[..."]:2561: attempt to get length of local 'respBody' (a number value) ("grpql4n78r.true" group 1 action 2) <0x7721f320>|
|06|04/27/20 8:09:15.602|Device_Variable::m_szValue_set device: 24 service: urn:toggledbits-com:serviceId:Reactor variable: runscene was: {"ctx155.scgrpql4n78r.true":{"starttime":1587989355,"context":155,"scene":"grpql4n78r.true","taskid":"ctx155.scgrpql4n78r.true","options":{"stopRunningScenes":true,"forceReactorScenes":true,"contextDevice":155,"stopPriorScenes":false},"owner":155,"lastgrouptime":1587989355,"lastgroup":0}} now: {"ctx155.scgrpql4n78r.true":{"starttime":1587989355,"context":155,"scene":"grpql4n78r.true","taskid":"ctx155.scgrpql4n78r.true","options":{"stopRunningScenes":true,"forceReactorScenes":true,"contextDevice":155,"stopPriorScenes":false},"owner":155,"lastgrouptime":1587989355,"lastgroup":1}} #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x7721f320>|
|06|04/27/20 8:09:15.604|Device_Variable::m_szValue_set device: 24 service: urn:toggledbits-com:serviceId:Reactor variable: runscene was: {"ctx155.scgrpql4n78r.true":{"starttime":1587989355,"context":155,"scene":"grpql4n78r.true","taskid":"ctx155.scgrpql4n78r.true","options":{"stopRunningScenes":true,"forceReactorScenes":true,"contextDevice":155,"stopPriorScenes":false},"owner":155,"lastgrouptime":1587989355,"lastgroup":1}} now: {} #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x7721f320>|

the 303 status above makes me think itā€™s redirecting to a response, but when i do the same request via Postman, it returns a 200 (see image)

Can you re-run the request is Postman and show the response headers instead of the request headers?

OK. Nothing conclusive. I was hoping to point you to a better URL. I fixed the error, but thatā€™s not going to stop the request from being flagged as trouble because of the HTTP response code.

Yeah, itā€™s what I figured, just wanted to let you know. Things seem to be working correctly even with the warning, so not an issue at all. I honestly though you would discard the response if I selected the (ignore/discard response) option in the action. Anyhoo, since it is working I wouldnā€™t waste any time on it. Cheers.