Closed raadiy closed 2 years ago
Hi, probably request got corrupted before going to json parser.
Try to enable module logging by setting NGREST_MOD_DEBUG=1
The simplest method is to add
#define NGREST_MOD_DEBUG 1
right in ngrest_server.h
after include.
then rebuild ngrest and check for /tmp/ngrest_debug_*.log
logs
Hi,
With NGREST_MOD_DEBUG enabled, the following are the logs. I doubted that the issue could be in the patchHandler that I had written, but ruled that out since the same works fine with the inbuilt ngrest httpd server. There is something different in the flow via the apache module :
====cat ngrest_debug_78267.log====
p78267 t1223846208; /home/tester/.ngrest/ngrest/modules/apache2/src/mod_ngrest.c[182]: ngrest_register_hooks p78267 t1223846208; /home/tester/.ngrest/ngrest/modules/apache2/src/mod_ngrest.c[187]: ngrest_set_ngrest_services_path: Using ngrest services path: [/test/node/lib/ngrest_srv] p78267 t1223846208; /home/tester/.ngrest/ngrest/modules/apache2/src/mod_ngrest.c[195]: ngrest_set_ngrest_filters_path: Using ngrest filters path: [/test/node/lib/ngrest_filter] p78267 t1223846208; /home/tester/.ngrest/ngrest/modules/apache2/src/mod_ngrest.c[161]: mod_ngrest_shutdown p78267 t1223846208; /home/tester/.ngrest/ngrest/modules/apache2/src/mod_ngrest.c[182]: ngrest_register_hooks p78267 t1223846208; /home/tester/.ngrest/ngrest/modules/apache2/src/mod_ngrest.c[187]: ngrest_set_ngrest_services_path: Using ngrest services path: [/test/node/lib/ngrest_srv] p78267 t1223846208; /home/tester/.ngrest/ngrest/modules/apache2/src/mod_ngrest.c[195]: ngrest_set_ngrest_filters_path: Using ngrest filters path: [/test/node/lib/ngrest_filter] p78269 t645842688; /home/tester/.ngrest/ngrest/modules/apache2/src/mod_ngrest.c[112]: mod_ngrest_handler p78269 t645842688; /home/tester/.ngrest/ngrest/modules/apache2/src/mod_ngrest.c[121]: mod_ngrest_handler: server startup: #0: OK p78269 t645842688; /home/tester/.ngrest/ngrest/modules/apache2/src/mod_ngrest.c[135]: mod_ngrest_handler: Dispatching request p78269 t645842688; /home/tester/.ngrest/ngrest/modules/apache2/src/mod_ngrest.c[63]: mod_ngrest_read_client_callback: REMAINING: 0 / 1232 p78269 t645842688; /home/tester/.ngrest/ngrest/modules/apache2/src/mod_ngrest.c[64]: mod_ngrest_read_client_callback: res: 1232 p78269 t645842688; /home/tester/.ngrest/ngrest/modules/apache2/src/mod_ngrest.c[86]: mod_ngrest_write_client_callback: response size: 59 p78269 t645842688; /home/tester/.ngrest/ngrest/modules/apache2/src/mod_ngrest.c[153]: mod_ngrest_handler
====cat ngrest_78269.log====
D/15-04-2022 02:31:22.016 Deployment.cpp:84 deploy: Deploying service library: /test/node/lib/ngrest_srv/serverstatus.so... D/15-04-2022 02:31:22.019 Deployment.cpp:120 deployStatic: Deploying service group name: ngrest D/15-04-2022 02:31:22.019 ServiceDispatcher.cpp:260 registerService: Registering service ngrest.ServerStatus V/15-04-2022 02:31:22.019 ServiceDispatcher.cpp:291 registerService: Registering resource: GET /ngrest/filters V/15-04-2022 02:31:22.019 ServiceDispatcher.cpp:291 registerService: Registering resource: GET /ngrest/services V/15-04-2022 02:31:22.019 ServiceDispatcher.cpp:291 registerService: Registering resource: GET /ngrest/service/{name} V/15-04-2022 02:31:22.019 ServiceDispatcher.cpp:291 registerService: Registering resource: GET /ngrest/operation/{serviceName}/{operationName} D/15-04-2022 02:31:22.019 ServiceDispatcher.cpp:325 registerService: Service ngrest.ServerStatus has been registered D/15-04-2022 02:31:22.019 Deployment.cpp:84 deploy: Deploying service library: /test/node/lib/ngrest_srv/favicon.so... D/15-04-2022 02:31:22.020 Deployment.cpp:120 deployStatic: Deploying service group name: ngrest D/15-04-2022 02:31:22.020 ServiceDispatcher.cpp:260 registerService: Registering service ngrest.Favicon V/15-04-2022 02:31:22.020 ServiceDispatcher.cpp:291 registerService: Registering resource: GET /favicon.ico/ D/15-04-2022 02:31:22.020 ServiceDispatcher.cpp:325 registerService: Service ngrest.Favicon has been registered D/15-04-2022 02:31:22.020 Deployment.cpp:84 deploy: Deploying service library: /test/node/lib/ngrest_srv/snsres_svr.so... D/15-04-2022 02:31:22.033 Deployment.cpp:120 deployStatic: Deploying service group name: D/15-04-2022 02:31:22.033 ServiceDispatcher.cpp:260 registerService: Registering service snsres_svr V/15-04-2022 02:31:22.033 ServiceDispatcher.cpp:291 registerService: Registering resource: GET /testEndPoint/{arg1} V/15-04-2022 02:31:22.033 ServiceDispatcher.cpp:291 registerService: Registering resource: PATCH /testEndPoint/ V/15-04-2022 02:31:22.033 ServiceDispatcher.cpp:291 registerService: Registering resource: POST /testEndPoint/ D/15-04-2022 02:31:22.033 ServiceDispatcher.cpp:325 registerService: Service snsres_svr has been registered D/15-04-2022 02:31:22.033 FilterDeployment.cpp:82 deploy: Deploying filter library: /test/node/lib/ngrest_filter/ngrestscmwifilter.so... D/15-04-2022 02:31:22.034 FilterDeployment.cpp:118 deployStatic: Deploying filter group: ScmWiFilterGroup W/15-04-2022 02:31:22.034 ngrest_server.cpp:307 ngrest_server_dispatch: CHGD00 before engine.dispatchMessage D/15-04-2022 02:31:22.034 ServiceDispatcher.cpp:360 dispatchMessage: Dispatching message /testEndPoint D/15-04-2022 02:31:22.034 ServiceDispatcher.cpp:380 dispatchMessage: Invoking service operation snsres_svr/patchHandler W/15-04-2022 02:31:22.034 ngrest_server.cpp:355 ngrest_server_dispatch: in Json::Value::operator: requires arrayValue
I think you should log the whole body of request you received in your patchHandler, . Probably it's truncated..
Thank you... my apologies, I found that it was an error in the test database that I had setup. Thanks again.
Hi Dmitry,
I see the following error while running NGREST as an apache webserver module:
W/14-04-2022 00:19:15.366 ngrest_server.cpp:331 ngrest_server_dispatch: in Json::Value::operator: requires arrayValue
But, I do not get this error while running it with the inbuilt httpd server that comes with ngrest. Can you please take a look and suggest.
Thanks Raajesh