catchpoint/WebPageTest.api-nodejs

occur WPTAPIError 403 error

Closed this issue · 7 comments

I got this error when using wpt.runTest(url, options) with this package today, and there was no problem before:

{
name: 'WPTAPIError',
code: 403,
message: 'Forbidden'
}

I am also getting this error

I am also getting this error

I don't see anything abnormal from our side. If you email support@webpagetest.org with your ip and request options, we can investigate further.

When I use wpt.runTest(url, options, (err, result) => {console.log(err)}) ,the err occurs.
Here are my options:
{
  options: {
    firstViewOnly: true,
    pollResults: 5,
    timeout: 300,
    runs: 1,
    device: 'Samsung Galaxy S7',
    emulateMobile: true,
    label: 'emulate mobile device',
    location: 'tencent-shanghai'
  }
}
{
  options: {
    firstViewOnly: true,
    pollResults: 5,
    timeout: 300,
    runs: 1,
    label: 'emulate PC device',
    location: 'tencent-shanghai'
  }
}

The error will be like this:
Error
    at Object. (/Users/ox/check-project-text/node_modules/webpagetest/lib/helper.js:213:25)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object. (/Users/ox/check-project-text/node_modules/webpagetest/lib/webpagetest.js:14:12)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object. (/Users/ox/check-project-text/server/tasks/webpagetest/index.js:1:21)
    at Module._compile (node:internal/modules/cjs/loader:1256:14) {
  name: 'WPTAPIError',
  code: 403,
  message: 'Forbidden'
}

In my code, all my requests are concurrent, which may be for a location, and errors will occur when they are concurrently sent one by one. (The previous code is also concurrent, but it has been running normally, and 403 errors occurred two days later.)

By the way, I use the nodejs package which is named webpagetest@0.73.
I'm looking forward to hearing back from you, thank you. @mjkozicki

For me sometimes It gives error sometimes it works, so the problem must be in api rather than the our code.

There was a configuration issue that has been resolved. Requests with a valid key should not be restricted.

It's already working. Thanks @mjkozicki