Moodle for mobile

"Invalid response value detected"

 
Picture of Brian Sorrell
"Invalid response value detected"
 

Hello.

I've read other entries regarding this error, but I have not been able to solve the problem. This situation is this:

I have an instance of Moodle on Server A. It works well, the app connects, etc. This is my test case.

I copied the test server to Server B. Now I am able to connect to the server via the app, enter my login information, but when retrieving the course listing, I get this error.

Any thoughts on what might to look at that might be different between the two servers and causing the problem. Or is there somewhere that errors from the app are logged? I can't find a reference to such a thing.

Cheers,

Brian.

 
Average of ratings: -
Picture of Brian Sorrell
Re: "Invalid response value detected"
 

Update:

I'm able to load the course listing when I hide one of my courses. Clearly, something is amiss with that course, but the error doesn't indicate what. Any guidance on figuring out what's wrong would be appreciated.

 
Average of ratings: -
Picture of Péter Lukács
Re: "Invalid response value detected"
 
Dear Brian, you can always set debug level to "Developer" to get more debug messages (at Site administration -> Development -> Debugging). After this is set repeat the steps leading to the error, and check your server log files.
To be honest, copiing server 1 database and files to server 2 isnt make a 1:1 copy if your server environments are different. Compare your apache (or other http daemon) and php versions and configs.
 
Average of ratings: -
Picture of Péter Lukács
Re: "Invalid response value detected"
 

I join to your subject. I receive the same error message, but only when i want to see Notifications in mobile app. This is the server log:

[:error] stderr: PHP message: Default exception handler: Missing parameter (token) Debug: 
[:error] stderr: PHP message: Default exception handler: Missing parameter (token) Debug:
[:error] stderr: Error code: missingparam
[:error] stderr: Error code: missingparam
[:error] stderr: * line 482 of /lib/setuplib.php: moodle_exception thrown
[:error] stderr: * line 482 of /lib/setuplib.php: moodle_exception thrown
[:error] stderr: * line 573 of /lib/moodlelib.php: call to print_error()
[:error] stderr: * line 573 of /lib/moodlelib.php: call to print_error()
[:error] stderr: * line 45 of /webservice/pluginfile.php: call to required_param()
[:error] stderr: * line 45 of /webservice/pluginfile.php: call to required_param()



I using 3.5.1 mobile app on a Moodle 3.5.1+ (Build: 20180713).

I tested this on an older Moodle site (3.3.2+ (Build: 20171027)) without any error messages.

Any suggestions are welcome sad


 
Average of ratings: -
Picture of Péter Lukács
Re: "Invalid response value detected"
 

Dear Brian,

I think our problems exists because of unset capabilities. I created a new ordiary user (student) and its working with him without any error messages.


To narrow it down follow these instructions:

https://docs.moodle.org/dev/Moodle_Mobile_debugging_WS_requests


ws requests debug info from chrome:


Request:

Form Data
useridto: 3
useridfrom: 0
type: notifications
read: 0
newestfirst: 1
limitfrom: 0
limitnum: 20
moodlewssettingfilter: true
moodlewssettingfileurl: true
wsfunction: core_message_get_messages
wstoken:(censored)

Response:

{exception: "invalid_response_exception", errorcode: "invalidresponse",…}
errorcode:"invalidresponse"
exception:"invalid_response_exception"
message:"Érvénytelen válaszérték"
I hope some developers can dig something out from this.

 
Average of ratings: -
Picture of Dani Palou
Re: "Invalid response value detected"
Core developersMoodle HQParticularly helpful MoodlersPlugin developers

Hi Peter,

if you set the debug level to "Developer" the WS response should give you a better error message, telling you exactly which field is failing. Can you copy it here?

IMO the error "Missing parameter (token)" pasted above shouldn't be related to this.

Cheers,

Dani

 
Average of ratings: -
Picture of Rafiq Muhammad
Re: "Invalid response value detected"
 

Hi Dani,

Have the same problem and this is the response in full debug. FYI, the data in message already encoded into json.


stdClass Object
(
    [exception] => invalid_response_exception
    [errorcode] => invalidresponse
    [message] => Invalid response value detected
    [debuginfo] => message => Invalid response value detected: Invalid external api response: the value is "{"status":"1","result":{"id":"1","category":"0","sortorder":"1","fullname":"RCYCI E-Learning","shortname":"RCYCI E-Learning","idnumber":"","summary":"<p>E-Learning in RCYCI<br><\/p>","summaryformat":"0","format":"site","showgrades":"1","newsitems":"10","startdate":"0","marker":"0","maxbytes":"0","legacyfiles":"0","showreports":"0","visible":"1","visibleold":"1","groupmode":"0","groupmodeforce":"0","defaultgroupingid":"0","lang":"","calendartype":"","theme":"","timecreated":"1424755022","timemodified":"1480511045","requested":"0","enablecompletion":"0","completionnotify":"0","cacherev":"1539779835"}}", the server was expecting "text" type
)


 
Average of ratings: -
Picture of Rafiq Muhammad
Re: "Invalid response value detected"
 

Update:

Apparently I found that one of my field has HTML code and my return type has been set as PARAM_TEXT.

In this thread (https://moodle.org/mod/forum/discuss.php?d=349993), Davo Smith recommended to use PARAM_TEXT for JSON type.

Thanks


 
Average of ratings: -
Picture of Dani Palou
Re: "Invalid response value detected"
Core developersMoodle HQParticularly helpful MoodlersPlugin developers

Hi Brian,

please make sure that your site has installed the language pack that is used in that course. If the course uses a language that isn't installed in the site, then this error is raised.

Cheers,

Dani

 
Average of ratings: -