AWS Private instance API 400

I’ve set up an AWS box using your AMI on eu-west-1. It works great doing tests from the web interface.

We have code set up successfully making API calls to Webpagetest on the public boxes.

We change the target of those API calls to our own private instance, we get:

{ statusCode: 400,
statusText: ‘Invalid Location, please try submitting your test request again.’ }

The Location we’re sending in is eu-west-1:Chrome.

Our ‘getLocations’ shows we have an idle agent at eu-west-1:Chrome.

The locations.ini file is empty, as deployed.

The key looks to be working & authenticating, given the error.

What am I missing please? What other info would help?

Many thanks

Ben

I’m having the same issue. I just set up an instance in us-east-1. I tried kicking off a test via the API not giving a location and I get that API response. I checked the /getLocations.php endpoint and get

"data": { "us-east-1:Chrome": { "Label": "US East (N. Virginia)", "location": "us-east-1", "Browser": "Chrome", "relayServer": null, "relayLocation": null, "labelShort": "US East (N. Virginia) - Chrome", "default": true, ....

back. So thinking that location is default I wouldn’t think I’d need to pass in a location. I try to pass in us-east-1:Chrome for location anyway and still get that API 400 response. I check AWS console and it hadn’t spun up any test agent instances. I kick off a test from the web UI and I see it spin up an agent and my test works. Try again via API and I still get that 400 response.

From the comments in ec2_locations.ini it doesn’t sound like any locations need to be put into locations.ini as the two files get merged provided the ec2_locations=1 in settings.ini which I’ve verified it does. I’m befuddled.

Thanks themark. Still stuck on this one I’m afraid, I can’t find anything in the docs which tells you how to enable API calls to your private instance.

Think I’ve figured this out - at least I got it working for myself. Hopefully this solves your issue too! During setup of the AMI I passed in the API key which I got from the public instance at webpagetest.org. Something of the form “A.1234e5…”. This gets stored in /var/www/webpagetest/www/settings/keys.ini. I ended up removing the “A.” and just leaving everything else, ie. 1234e5… I restarted nginx and then I used 1234e5… as my API key in my calls and I was able to get a test to run.

We are jumping around the room with joy! Thanks very much, test ran first time with edited API key!

Thank you!

Ben