catchpoint / WebPageTest.api-nodejs

WebPageTest API wrapper for NodeJS
MIT License
1.64k stars 173 forks source link

runTestAndWait() often causes 429 Too Many Requests errors #197

Open rejhgadellaabsl opened 1 month ago

rejhgadellaabsl commented 1 month ago

I noticed that runTestAndWait() has recently started to throw 429 errors. It seems to be caused by the polling the function performs.

Related: I tried to set a high number for the pollResults option (we used the default, which shouldn't cause 429 either imo :)), but it doesn't seem to do anything, the status updates (e.g., Waiting at the front of the queue...) are printed at the same-ish interval regardless of what I configure.

wpt.runTestAndWait( url, {
  location: 'gce-europe-west4',
  connectivity: 'Cable',
  runs: 1,
  firstViewOnly: true,
  keepOriginalUserAgent: true,
  pollResults: 30,
  timeout: 120,
  lighthouse: false,
})
Testing is in progress, please be patient
Waiting at the front of the queue...
Waiting at the front of the queue...
Waiting at the front of the queue...
Waiting at the front of the queue...
Waiting at the front of the queue...
Waiting at the front of the queue...
Waiting at the front of the queue...
Waiting at the front of the queue...
Test Started 5 seconds ago
Test Started 19 seconds ago
Error
    at Object.<anonymous> (/home/ubuntu/git/bsl-sites/bsl-speedtestmonitor/node_modules/webpagetest/lib/helper.js:213:25)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at Module.require (node:internal/modules/cjs/loader:1311:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/home/ubuntu/git/bsl-sites/bsl-speedtestmonitor/node_modules/webpagetest/lib/webpagetest.js:14:12)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10) {
  name: 'WPTAPIError',
  code: 429,
  message: 'Too Many Requests'
}
AatibMeer commented 1 month ago

Hello there,

This looks more like a support issue. I would suggest logging a ticket with WebPageTest support at support@webpagetest.org. When submitting your ticket, please include the following information:

Additionally, please confirm if you are passing the key in the headers.

xdevnull commented 1 month ago

I have the same issue. It might be related to this recent changes https://github.com/catchpoint/terraform-provider-catchpoint/commit/0d406323a6ee35a2f49b6d86d03934a4b7b9d511

rejhgadellaabsl commented 4 weeks ago

@AatibMeer I missed your reply. I've just reached out to support. Thanks!