Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Debugging network requests in the Moodle App: Difference between revisions

From MoodleDocs
No edit summary
Line 44: Line 44:
Now, you are ready to debug all the Web Service requests done to your Moodle site by the Mobile app.
Now, you are ready to debug all the Web Service requests done to your Moodle site by the Mobile app.


== How to debug a WS error ==
== Debugging a Web Service (WS) error ==


[[{{ns:file}}:moodlemobile_chrome_debug_ws_error.png|thumb|300px]]
[[{{ns:file}}:moodlemobile_chrome_debug_ws_error.png|thumb|300px]]
Line 50: Line 50:
# Connect to your site and browse to the functionality returning an error
# Connect to your site and browse to the functionality returning an error
# In your right Window you will see a list of requests done by the app to your Moodle site (token.php server.php server.php etc..)
# In your right Window you will see a list of requests done by the app to your Moodle site (token.php server.php server.php etc..)
# Click on each one of them (starting by the last one in the list) but skipping those that doesn’t start with token.php or server.php
# Click on each one of them (starting by the last one in the list) but skipping those that don’t start with token.php or server.php
# In the new sub-window open select the “Response” tab and check if you see an error
# In the new sub-window open select the “Response” tab and check if you see an error
# Copy the error and go to the Moodle FAQ to see if there is a known solution for it
# Copy the error and go to the Moodle FAQ to see if there is a known solution for it

Revision as of 12:07, 11 December 2017


Introduction

This guide will teach you how to find and report problems that may be causing the Mobile app not to work on your site.

This guide is specially useful for the following problems:

  • When you are not able to log-in on your site.
  • When you receive one of the following error messages in the app:
    • Can not find data record in database table external_functions
    • Invalid response value detected
    • Cannot get course contents

Requeriments

  • Moodle 3.0 onwards (your site needs at least this version)
  • Google Chrome browser
moodlemobile enabledebug.png

Enabling debugging on your Moodle site

The first thing we need to do is enabling debugging on your Moodle site.

  • Go to Site Administration > Development > Debugging
  • Chosse "DEVELOPER: .." option in "Debug messages"
  • Check "Display debug messages"

Please, remember to disable Debugging on your site (setting "Debug messages" to NONE) once you've finished debugging your problem.


Setting up Chrome

moodlemobile chrome inspect network.png

Debugging a Mobile app is not easy at all, this is why we have published and online web version of the app that could be easily debuggable just using the Chrome browser.

  1. Open your Chrome Browser and visit the following URL: https://prototype.moodle.net/mobile/webapp/
  2. Now, open your browser options (icon at the top-right of your browser Window)
  3. Go to More tools -> Developer tools
  4. Dock the new Windows to the right side (in the new window top-right options choose “Dock to the right” icon)
  5. Select the Network tab (at the top-center)
  6. Enable the filter (filter shape icon) so it changes to color red
  7. In the new text field displayed when enabling the filter write “.php” without the “”

Now, you are ready to debug all the Web Service requests done to your Moodle site by the Mobile app.

Debugging a Web Service (WS) error

moodlemobile chrome debug ws error.png
  1. Connect to your site and browse to the functionality returning an error
  2. In your right Window you will see a list of requests done by the app to your Moodle site (token.php server.php server.php etc..)
  3. Click on each one of them (starting by the last one in the list) but skipping those that don’t start with token.php or server.php
  4. In the new sub-window open select the “Response” tab and check if you see an error
  5. Copy the error and go to the Moodle FAQ to see if there is a known solution for it
  6. If you are unable to find a solution, post in the moodle for mobile forum the error

See also