- Posts: 11
- Thank you received: 2
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
- Topic Author
- Offline
- New Member
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
- Topic Author
- Offline
- New Member
- Posts: 11
- Thank you received: 2
Please Log in to join the conversation.
- Haris.Pap
- Offline
- New Member
- Posts: 17
- Thank you received: 0
Here is the post mentioned above , but its solution seems mainly related to the R limer package.Please, refer to #230772
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
Thx in advance !
Please Log in to join the conversation.
- tammo
- Offline
- Official LimeSurvey Partner
- Posts: 963
- Thank you received: 217
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.
- Haris.Pap
- Offline
- New Member
- Posts: 17
- Thank you received: 0
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
- Offline
- Official LimeSurvey Partner
- Posts: 963
- Thank you received: 217
Tammo
Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
Please Log in to join the conversation.
- migliorati
- Topic Author
- Offline
- New Member
- Posts: 11
- Thank you received: 2
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)
}
Please Log in to join the conversation.
- Haris.Pap
- Offline
- New Member
- Posts: 17
- Thank you received: 0
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
- Topic Author
- Offline
- New Member
- Posts: 11
- Thank you received: 2
I don't know if such a change was documented, but it would be important.
Please Log in to join the conversation.
- Jane
- Offline
- Official LimeSurvey Partner
- Posts: 16
- Thank you received: 14
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.
Please Log in to join the conversation.
- Jane
- Offline
- Official LimeSurvey Partner
- Posts: 16
- Thank you received: 14
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.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
- Offline
- Official LimeSurvey Partner
- Posts: 16
- Thank you received: 14
github.com/cloudyr/limer/pull/62
Please Log in to join the conversation.