Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

remotecontrol doesn't work after update to 6.3.5

  • migliorati
  • migliorati's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 7 months ago #230754 by migliorati
Please help us help you and fill where relevant:
Your LimeSurvey version:5.3
Own server or LimeSurvey hosting: own server
Survey theme/template: remotecontrol (API)
==================
Hi guys.
We updated limesurvey from 3 to 5.3, and now API seem not working: when I try (I'm working in R with limer package) a
get_session_key()
now I obtain an error:
Error: Argument 'txt' must be a JSON string, URL or file.
Everything was running before the update.
Please, someone can help me?
TX a lot

Please Log in to join the conversation.

  • migliorati
  • migliorati's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 7 months ago #230817 by migliorati
Replied by migliorati on topic remotecontrol doesn't work after update to 5.3
Please, refer to #230772

Please Log in to join the conversation.

More
1 year 7 months ago - 1 year 7 months ago #230994 by Haris.Pap
Replied by Haris.Pap on topic remotecontrol doesn't work after update to 5.3

Please, refer to #230772



 
Here is the post mentioned above , but its solution seems mainly related to the R limer package.

I am experiencing a similar issue, where get_session_key results to 500 Internal Server Error:

PHP Fatal error:  Uncaught Exception:
Unable to connect to .../admin/remotecontrol in /var/www/.../application/libraries/jsonRPCClient.php:146
Stack trace:
#0 /var/www/.../requests/export_responses.php(17): jsonRPCClient->__call()
#1 {main}
thrown in /var/www/.../application/libraries/jsonRPCClient.php on line 146,
referer: https://.../index.php/786859


While this works perfectly with LimeSurvey Version 5.3.24+220711 on localhost, it won't work on our production-site (using the exact same version).

(Note: The url, user and pass above are edited for privacy reasons)

Since ...
  • the API-related settings and request-URL are correct (as described in this previous post )
  • the username and password belong to a normal registered user
  • the login uses the auth_db (internal database authentication) method
... what else might be wrong?

Thx in advance !


 
Attachments:
Last edit: 1 year 7 months ago by Haris.Pap.

Please Log in to join the conversation.

  • tammo
  • tammo's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
1 year 7 months ago #231008 by tammo
For us this works:

library(limer) 
options(lime_api = ' yourdomain.nl/index.php/admin/remotecontrol ')

options(lime_username = 'report')
options(lime_password = 'password')
session_key <- get_session_key()


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl

Please Log in to join the conversation.

More
1 year 7 months ago #231010 by Haris.Pap
Replied by Haris.Pap on topic remotecontrol doesn't work after update to 5.3
Thanks. So, probably the answer is that remotecontrol works after the 5.3 update.

To rephrase my question above , could someone point me to the configuration(s), which cause the API to return a 500 Internal Server Error?
(while using the same code & LimeSurvey settings and version, it works locally - using a XAMPP server)

Thx!

Please Log in to join the conversation.

  • tammo
  • tammo's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
1 year 7 months ago #231011 by tammo
Sorry, cannot help you here, we never used your way of working.

Tammo


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl

Please Log in to join the conversation.

  • migliorati
  • migliorati's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 7 months ago #231012 by migliorati
Replied by migliorati on topic remotecontrol doesn't work after update to 5.3
Hi Haris.
In my case the code reported by Tammo (the code normally used to access LimeSurvey) didn't work on the release 5.3 of LimeSurvey.
Looking a bit in detail the implementation of get_session_key reported on github:
github.com/cloudyr/limer/blob/master/R/get_session_key.R
I verified that the problem producing the http 500 error is that the implementation uses the field "admin" in body.json definition, and this field doesn't seem available in versione5.3 (instead it was running in the old version).
Changing the implementation of get_session_key using the field "username", instead, is working:

mm_get_session_key <- function() {
body.json = list(method = "get_session_key",
id = 1,
params = list(username = getOption('lime_username'),
password = getOption('lime_password')))
r <- POST(getOption('lime_api'),
content_type_json(),
body = jsonlite::toJSON(body.json,
auto_unbox = TRUE))
session_key <- as.character(jsonlite::fromJSON(content(r, encoding="utf-8"))$result)
session_cache$session_key <- session_key
return(session_key)
}
The following user(s) said Thank You: r0bis

Please Log in to join the conversation.

More
1 year 7 months ago #231027 by Haris.Pap
Replied by Haris.Pap on topic remotecontrol doesn't work after update to 5.3
Thanks a lot for the info, which actually seems to be specific to the limer implementation.
Looking at the API implementation in application\helpers\remotecontrol\remotecontrol_handle.php, the get_session_key function uses only a username parameter.

The answer is that remotecontrol works correctly with LimeSurvey 5.3.

The solution to my problem was that the requests were not being resolved by the server.  An entry in the hosts file solved the issue.

Please Log in to join the conversation.

  • migliorati
  • migliorati's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 7 months ago #231029 by migliorati
Replied by migliorati on topic remotecontrol doesn't work after update to 5.3
Sure, but something has changed in Limesurvey, too, because the same code was working in past releases.
I don't know if such a change was documented, but it would be important.

Please Log in to join the conversation.

  • Jane
  • Jane's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
1 year 3 months ago - 1 year 3 months ago #239195 by Jane
Did you also update your PHP from version 7 to version 8? If so, try loading a fixed limer:
devtools::install_github("Jan-E/limer", force = TRUE)
See my fork of limer at  github.com/Jan-E/limer/ for an explanation. See especially the commit + comment:
[url] github.com/Jan-E/limer/commit/bc807c61fb...376d814e80f126fc796c [/url] 

Please report back if this fixes your problems before I create a pull request for limer.
Last edit: 1 year 3 months ago by Jane. Reason: Link to the commit
The following user(s) said Thank You: r0bis

Please Log in to join the conversation.

  • Jane
  • Jane's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
1 year 3 months ago #239196 by Jane

Sure, but something has changed in Limesurvey, too, because the same code was working in past releases.
I don't know if such a change was documented, but it would be important.
 
Nothing has changed in Limesurvey, but PHP8 is not tolerant for non-existing keys. Probably somewhere in the remotecontrol code PHP8 misses a $username and exits with an error, while PHP7 skips over the error and returns a session_ley to LimeR. Debugging is hard, because the YII framework does not seem to log why the RC2 fails.

Please Log in to join the conversation.

  • Jane
  • Jane's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
1 year 3 months ago #239202 by Jane
Created PR in the limer repo:
github.com/cloudyr/limer/pull/62
The following user(s) said Thank You: DenisChenu, r0bis

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose