Skip to content

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

@rejhgadellaabsl

Description

@rejhgadellaabsl

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'
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions