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

More
3 years 1 month 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.

More
3 years 1 month ago #230817 by migliorati
Please, refer to #230772

Please Log in to join the conversation.

More
3 years 1 month ago - 3 years 1 month ago #230994 by Haris.Pap

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 !


 
Last edit: 3 years 1 month ago by Haris.Pap.

Please Log in to join the conversation.

More
3 years 1 month 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
3 years 1 month ago #231010 by Haris.Pap
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.

More
3 years 1 month 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.

More
3 years 1 month ago #231012 by migliorati
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
3 years 1 month ago #231027 by Haris.Pap
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.

More
3 years 1 month ago #231029 by migliorati
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.

More
2 years 8 months ago - 2 years 8 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: 2 years 8 months ago by Jane. Reason: Link to the commit
The following user(s) said Thank You: r0bis

Please Log in to join the conversation.

More
2 years 8 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.

More
2 years 8 months ago #239202 by Jane
The following user(s) said Thank You: DenisChenu, r0bis

Please Log in to join the conversation.

More
2 years 5 months ago - 2 years 5 months ago #242014 by r0bis
Thanks a lot for finding the bug and fixing it. There seems to be no response to that on the main limer branch. My server currently runs on PHP 7.3 and all was fine, but in the future, I will need to use github_install() from devtools to install limer from Jan-E's branch.
Code:
devtools::install_github("Jan-E/limer", force = TRUE)

r0berts
Last edit: 2 years 5 months ago by r0bis. Reason: added new information

Please Log in to join the conversation.

More
2 years 5 months ago - 2 years 5 months ago #242339 by Jane
See  Please merge PR get_session_key.R: fix PHP 8.1 major flaw #62  now. The PR was finally merged. LimeR is compatible with PHP 7 and PHP 8!
Last edit: 2 years 5 months ago by Jane.
The following user(s) said Thank You: r0bis

Please Log in to join the conversation.

More
1 year 9 months ago #252408 by iceclimber81
Hi Jane,

I know I'm joining this conversation late, but I'm still hoping for some help or illumination:

I use the R package limer to retrieve survey data via remotecontrol from Limesurvey Cloud. It worked well until early October (must have been LS version 6.2.11 then). Now, running on LS 6.3.6, I get the same error message as reported above when trying to get a session key with get_session_key(): "Error: Argument 'txt' must be a JSON string, URL or file."

I have already tried using your fixed version of limer devtools::install_github("Jan-E/limer", force = TRUE) but this hasn't changed the outcome. I don't know which version of PHP is used by Limesurvey Cloud.

Are others experiencing similar issues? Any thoughts on solutions?

Thanks!
Clemens


 

Please Log in to join the conversation.

Moderators: holchtpartner

Lime-years ahead

Online-surveys for every purse and purpose