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
1 year 2 weeks ago - 1 year 2 weeks 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: 1 year 2 weeks ago by r0bis. Reason: added new information

Please Log in to join the conversation.

  • Jane
  • Jane's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
1 year 1 week ago - 1 year 1 week 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: 1 year 1 week ago by Jane.
The following user(s) said Thank You: r0bis

Please Log in to join the conversation.

More
5 months 3 days ago #252408 by iceclimber81
Replied by iceclimber81 on topic remotecontrol doesn't work after update to 5.3
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.

More
5 months 3 days ago - 5 months 3 days ago #252412 by r0bis
This is really quite bad, I get the same error and the only change I made was used comfort update. Now LS version is

LimeSurvey Community Edition Version 6.3.6+231120

and my PHP has been 7.4 for a good few months and until this update was working well.

I played around with function from migliorati and came to conclusion that a lot of things work. But it seems that the response coming back from limesurvey might not be JSON? for example you do the usual limer options setup and then:

  body.json = list(method = "get_session_key",
                   id = 1,
                   params = list(username = getOption('lime_username'),
                                 password = getOption('lime_password')))
now you have the json rpc request (I think); then you give that request to httr::POST

POST(getOption('lime_api'),
            content_type_json(),
            body = jsonlite::toJSON(body.json,
                                    auto_unbox = TRUE))
you get a response similar to :Response [ lime.server.yours/index.php/admin/remotecontrol ]
Date: 2023-11-20 19:21
Status: 500
Content-Type: text/html; charset=UTF-8
Size: 20.8 kB
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
" www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns=" www.w3.org/1999/xhtml " xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>ArgumentCountError</title>

<style type="text/css">
/*<![CDATA[*/say instead of printing you save it to an object RRR, then I am sure in RRR$cookies[7] you have your session key

 

r0berts
Last edit: 5 months 3 days ago by r0bis.

Please Log in to join the conversation.

More
5 months 3 days ago - 5 months 3 days ago #252424 by iceclimber81
Replied by iceclimber81 on topic remotecontrol doesn't work after update to 5.3
Thanks for looking into this, r0bis.

I just experimented with limer / remotecontrol on different LS versions on my server and found that it still works on LS 6.3.4, but the upgrade to LS 6.3.5 (and later) breaks it.

When checking the changelog , I found this issue mentioned for 6.3.4 --> 6.3.5: Fixed issue #19214: JSON RPC response content type should be application/json (#3610) --> see issue described here: bugs.limesurvey.org/view.php?id=19214

If I understand correctly, starting from 6.3.5, the JSON RPC response content type is application/json, while before it was text/javascript. This might break the limer get_session_key() function.

UPDATE: Getting an error message:

When trying to call the remotecontrol API with the limer approach on LS 6.3.5 and later:
Code:
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))
xml <- content(r, encoding="utf-8")
rvest::html_text(xml)


the response shows an error message:
Code:
500: Internal Server Error
call_user_func_array(): Argument #1 ($callback) must be a valid callback, second array member is not a valid method

Unfortunately, I'm not familiar enough with JSON to figure out how to modify the request so it is valid.
 
Last edit: 5 months 3 days ago by iceclimber81.

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 months 2 days ago #252433 by DenisChenu
Replied by DenisChenu on topic remotecontrol doesn't work after update to 5.3
Please : report the issue,
community.limesurvey.org/bug-tracker/

Since this breaks a pre-existing system, it's a problem that needs to be solved!
 

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: iceclimber81

Please Log in to join the conversation.

More
5 months 2 days ago #252439 by iceclimber81
Replied by iceclimber81 on topic remotecontrol doesn't work after update to 5.3
Thanks, DenisChenu, I have reported the issue here:

bugs.limesurvey.org/view.php?id=19258
The following user(s) said Thank You: DenisChenu, r0bis

Please Log in to join the conversation.

More
5 months 2 days ago #252440 by r0bis
Yes, this is what I am also getting. It seems that there is no content at all in terms of JSON, that there is just a 500 ERROR page that is returned. From what I understand the normal expected response is a JSON string, but there is no JSON

The error arises in this call
> session_key <- as.character(jsonlite::fromJSON(content(r, encoding="utf-8"))$result)
> Error: Argument 'txt' must be a JSON string, URL or file

If you look at the content that jsonLite is trying to parse, it is an HTML document:
> content(r, encoding="utf-8")
{html_document}
<html xmlns=" www.w3.org/1999/xhtml " xml:lang="en" lang="en">
[1] <head>\n<meta http-equiv="Content-Type" content="text/html; charset=utf-8">\n<title>ArgumentCoun ...
[2] <body>\n<div class="container">\n\t<h1>ArgumentCountError</h1>\n\n\t<p class="message">\n\t\tToo

I also know too little about JSON and what is the normally expected return. If you still have some working LS versions, you could easily check if this content is something different.

My hypothesis is - RPC does not return JSON but an HTML error page that limer has no idea about as it expects only a JSON string

r0berts

Please Log in to join the conversation.

More
5 months 2 days ago - 5 months 2 days ago #252441 by r0bis

btw content is httr::content()


r0berts
Last edit: 5 months 2 days ago by r0bis.
The following user(s) said Thank You: iceclimber81

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 months 2 days ago #252445 by DenisChenu
Replied by DenisChenu on topic remotecontrol doesn't work after update to 5.3

My hypothesis is - RPC does not return JSON but an HTML error page that limer has no idea about as it expects only a JSON string
Seems to be a PHP issue.

Can try you activate log file ?
manual.limesurvey.org/Optional_settings/en#Logging_settings
with debug=2 ?

Then you have more detail on the error in the log file.

 

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.

Please Log in to join the conversation.

More
5 months 2 days ago #252448 by iceclimber81
Replied by iceclimber81 on topic remotecontrol doesn't work after update to 5.3
I find that unlikely given that I have tested it with LS 6.3.4 and 6.3.5, all running on PHP 8.2.9.

Will look at the log files later, though, just to make sure

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 months 2 days ago #252450 by DenisChenu
Replied by DenisChenu on topic remotecontrol doesn't work after update to 5.3
> PHP 8.2.9.

Warning : we still have issue with PHP 8.2 version.

You activate debug mode ?

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose