Problem/Motivation
Settings page of the module crashes when there are more than 20 zones available for selection.
Steps to reproduce 1.x
After upgrading to 8.x.-1.0-beta3 or 2.x and trying to go to the settings page/or trying to setup the module first time
Unable to connect to CloudFlare in order to validate credentials. Please try again later. Error message: Client error: `GET https://api.cloudflare.com/client/v4/zones?page=1&per_page=20&match=all` resulted in a `429 Too Many Requests` response: {"success":false,"errors":[{"code":10100,"message":"More than 1200 requests per 300 seconds reached. Please wait and con (truncated...)
Unable to connect to CloudFlare in order to validate credentials. Please try again later. Error message: Client error: `GET https://api.cloudflare.com/client/v4/zones?page=0&per_page=20&match=all` resulted in a `429 Too Many Requests` response: {"success":false,"errors":[{"code":10100,"message":"More than 1200 requests per 300 seconds reached. Please wait and con (truncated...)
- Upgrade module to 8.x.-1.0-beta3
- Navigate to admin/config/services/cloudflare
- Page times out
- Reload page see error at the top.
Steps to reproduce 2.x
On initial setup - try to press Next after providing credentials and see the page crash
On existing setup - visit the module settings page
Proposed resolution
Fix the code
Remaining tasks
Test
Comments
Comment #2
maxmendez commentedI faced this issue in my account that have more that one page of zones, reviewing the logic Zone->list Zones seems that creates an infinite loop.
Here my approach to fixed it.
Comment #3
maxmendez commentedComment #4
maxmendez commentedFixed and error in the while condition.
Comment #5
brunapimenta commentedDuring the development of #3362051 - Cloudflare PHP SDK is abandoned, affects v1 and v2 I could face the same issue and this solution worked perfectly. :)
Comment #6
rosk0I like the patch , but there is more works needs to happen here:
Comment #7
emil stoianov commentedHere is the patch from the duplicate issue
It will not make additional request if there is only one page.
The initial request is hardcoded to get the first page and additional requests (to get the next pages) will be made only if current page is less then total pages.
If someone knows how to create a test for this case please do.