Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error get_session_key() #63

Open
sebastianottmann opened this issue May 30, 2023 · 17 comments
Open

Error get_session_key() #63

sebastianottmann opened this issue May 30, 2023 · 17 comments

Comments

@sebastianottmann
Copy link

Thank you for the limer package.
When using get_session_key() I get the following error message:

Error: Argument txt must be a JSON string, URL or file.

I have installed the latest version of the limer package and also already looked at possible solutions to the problem here on github. The script is also run regularly and in mid-May, it was still working without error message.

Are there any other ideas how I can fix the problem?

Thanks
Sebastian

@Jan-E
Copy link
Contributor

Jan-E commented May 30, 2023

Which version of Limesurvey are you running? And which version of PHP?

@sebastianottmann
Copy link
Author

Limesurvey 5.3.27
PHP 8.1.2

Do you think that with an update to the latest version the problem should be solved?

@Jan-E
Copy link
Contributor

Jan-E commented May 30, 2023

Limer should work fine with LS 5.3. Did you recently update your PHP version? PHP 8.1 had a known problem with limer, which was solved by bc807c6 on April 12. If you did not update limer after that date: do it now.

With what script are you calling get_session_key()? If it is a custom script written in R or PHP, please share the script. The change from ‘admin’ to ‘username’ which was needed for the jsonRPCClient.php of Limesurvey might break custom scripts.

@sebastianottmann
Copy link
Author

I have updated limer before publishing the issue. I also just uninstalled the package and reinstalled it again. Unfortunately the problem is still there.

I have to check with my administrator if PHP was updated on the server.

I am using an R script to address the function. In the script the data from Limesurvey should be loaded and then analyzed. At the beginning, I have defined the following (in the original script with content):

options(lime_api = "")
options(lime_username = "")
options(lime_password = "")
limer::get_session_key()

As already written, the script still worked without problems in mid-May.

@Jan-E
Copy link
Contributor

Jan-E commented May 30, 2023

Mmm. We are using for some R-scripts the same calling sequence:
https://forums.limesurvey.org/index.php/forum/installation-a-update-issues/127953-remotecontrol-doesn-t-work-after-update-to-php-8-1#231008

But I did not test that yet with a Limesurvey running under PHP 8.1. Will take some time before I can do that.

@Jan-E
Copy link
Contributor

Jan-E commented May 30, 2023

BTW: I would not be surprised if LS 5.3 has problems with PHP 8.1. PHP 8.1 compatibility is on the roadmap for LS 6.0.

https://forums.limesurvey.org/index.php/forum/installation-a-update-issues/133917-is-php-8-1-or-8-2-supported-by-ls-5-x

https://manual.limesurvey.org/LimeSurvey_roadmap#LimeSurvey_5.3

Please check with your administrator when the PHP update was done.

@sebastianottmann
Copy link
Author

Thanks for the help and the answer. I clarify with my administrator that the Limesurvey is updated to the current version and would then try the data download with limer again.

@Jan-E
Copy link
Contributor

Jan-E commented Jun 13, 2023

Is the issue resolved now? Then please close it.

@sebastianottmann
Copy link
Author

Unfortunately, the issue persists. We are now trying to update to version 6 of Limesurvey and hope that the problem will then no longer exist. I would then let you know again if this is the case.

@r0bis
Copy link

r0bis commented Jul 31, 2023

Just to mention - this kind of error can occur also when server returns unexpected response - for example you are hosting LS on one of the typical platforms like a2 etc., and the system decides to check if you are not a bot (captcha). You can check if this is the case opening your LS installation admin URL https://yourLSurl.org/admin and if you see a captcha, accompanied by something like "we need to verify because of some unusual traffic" - then you solve the captcha and re-run script you were using limer in - it worked for me.

@statistaBradleyPresentati

I also have this problem. LS 6.2.1 with PHP 8.0.28. I've tried using the old params (admin, password) as well as the new (username, password, plugin = 'AuthDB')- no luck. Still runs great on an LS 3.22.28 with PHP 7.2.3, so I'm not sure what's going on.

@Jan-E
Copy link
Contributor

Jan-E commented Aug 23, 2023

@statistaBradleyPresentati What is the exact command you are using to get the session key? Are you using PHP or R to get it?

@statistaBradleyPresentati
Copy link

statistaBradleyPresentati commented Aug 23, 2023

@statistaBradleyPresentati What is the exact command you are using to get the session key? Are you using PHP or R to get it?

This is what ended up working for me (in R):

body.json <- list(method = "get_session_key", params = list(username = user, password = pw), id = 1)

  r <- POST(url = "example.url", content_type_json(),
          body = jsonlite::toJSON(body.json, auto_unbox = TRUE))

  session_key <- as.character(jsonlite::fromJSON(content(r, encoding="utf-8"))$result)

The id=1 parameter made the difference, at least in my case.

@struckma
Copy link

I had to modify the httr::content() call amending the argument as = "text" as proposed by the httr manual to suppress automatic parsing of the JSON response from the server.

@jorgesinval
Copy link

jorgesinval commented Nov 21, 2023

I had to modify the httr::content() call amending the argument as = "text" as proposed by the httr manual to suppress automatic parsing of the JSON response from the server.

Thank you. I updated limer to the last version and now it is working properly.

@Jan-E
Copy link
Contributor

Jan-E commented Nov 21, 2023

@jorgesinval With which Limesurvey version are you working? Standard limer with LS 6.3.5+ is broken. See #66

@jorgesinval
Copy link

jorgesinval commented Nov 21, 2023

I am using 6.2.5. Thanks for the warning, @Jan-E. I will not update LS to 6.3.5 version for now. Before updating LS to the latest version, I used Python's citric package. It worked but it was a workaround, using reticulate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants