Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError in Aws sdk in 24.12 release #3133

Open
DmitriyStoyanov opened this issue Dec 27, 2024 · 0 comments
Open

Uncaught TypeError in Aws sdk in 24.12 release #3133

DmitriyStoyanov opened this issue Dec 27, 2024 · 0 comments
Labels
Type: Bug An issue or pull request relating to a bug in WebPageTest

Comments

@DmitriyStoyanov
Copy link

DmitriyStoyanov commented Dec 27, 2024

Description

After update private wpt to the latest release 24.12 (btw, works fine on 23.01 release), faced with issues during cron jobs that triggers every 5 minutes here:
https://github.com/catchpoint/WebPageTest/blob/master/www/cron/5min.php#L54

which triggers EC2_GetRunningInstances

function EC2_GetRunningInstances() {

and then on this line:
$response = $ec2->describeRegions();

it fails with error:

==> /var/log/php7.4-fpm.log <==
[27-Dec-2024 08:00:01] WARNING: [pool www] child 805 said into stderr: "NOTICE: PHP message: Argument 1 passed to Symfony\Component\EventDispatcher\EventDispatcher::dispatch() must be an object, string given, called in /var/www/webpagetest/www/lib/aws/Guzzle/Common/AbstractHasDispatcher.php on line 40"
[27-Dec-2024 08:00:01] WARNING: [pool www] child 805 said into stderr: "NOTICE: PHP message: PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Symfony\Component\EventDispatcher\EventDispatcher::dispatch() must be an object, string given, called in /var/www/webpagetest/www/lib/aws/Guzzle/Common/AbstractHasDispatcher.php on line 40 and defined in /var/www/webpagetest/vendor/symfony/event-dispatcher/EventDispatcher.php:48"
[27-Dec-2024 08:00:01] WARNING: [pool www] child 805 said into stderr: "Stack trace:"
[27-Dec-2024 08:00:01] WARNING: [pool www] child 805 said into stderr: "#0 /var/www/webpagetest/www/lib/aws/Guzzle/Common/AbstractHasDispatcher.php(40): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('client.command....', Object(Guzzle\Common\Event))"
[27-Dec-2024 08:00:01] WARNING: [pool www] child 805 said into stderr: "#1 /var/www/webpagetest/www/lib/aws/Guzzle/Service/Client.php(91): Guzzle\Common\AbstractHasDispatcher->dispatch('client.command....', Array)"
[27-Dec-2024 08:00:01] WARNING: [pool www] child 805 said into stderr: "#2 /var/www/webpagetest/www/lib/aws/Guzzle/Service/Client.php(76): Guzzle\Service\Client->getCommand('DescribeRegions', Array)"
[27-Dec-2024 08:00:01] WARNING: [pool www] child 805 said into stderr: "#3 /var/www/webpagetest/www/lib/aws/Aws/Common/Client/AbstractClient.php(106): Guzzle\Service\Client->__call('DescribeRegions', Array)"
[27-Dec-2024 08:00:01] WARNING: [pool www] child 805 said into stderr: "#4 /var/www/webpagetest/www/ec2/ec2.inc.php(448): A..."

==> /var/log/nginx/error.log <==
2024/12/27 08:00:01 [error] 614#614: *628 FastCGI sent in stderr: "PHP message: Argument 1 passed to Symfony\Component\EventDispatcher\EventDispatcher::dispatch() must be an object, string given, called in /var/www/webpagetest/www/lib/aws/Guzzle/Common/AbstractHasDispatcher.php on line 40PHP message: PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Symfony\Component\EventDispatcher\EventDispatcher::dispatch() must be an object, string given, called in /var/www/webpagetest/www/lib/aws/Guzzle/Common/AbstractHasDispatcher.php on line 40 and defined in /var/www/webpagetest/vendor/symfony/event-dispatcher/EventDispatcher.php:48
Stack trace:
#0 /var/www/webpagetest/www/lib/aws/Guzzle/Common/AbstractHasDispatcher.php(40): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('client.command....', Object(Guzzle\Common\Event))
#1 /var/www/webpagetest/www/lib/aws/Guzzle/Service/Client.php(91): Guzzle\Common\AbstractHasDispatcher->dispatch('client.command....', Array)
#2 /var/www/webpagetest/www/lib/aws/Guzzle/Service/Client.php(76): Guzzle\Service\Client->getCommand('DescribeRegions', Array)
#3 /var/www/webpagetest/www/lib/aws/Aws/Common/Client/AbstractClient.php(106): Guzzle\Service\Client->__call('DescribeRegions', Array)
#4 /var/www/webpagetest/www/ec2/ec2.inc.php(448): A" while reading response header from upstream, client: 127.0.0.1, server: _, request: "GET /cron/5min.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "127.0.0.1"

Steps to reproduce

Install wpt 24.12 release
www/settings/settings.ini should contain valid aws access/secret key

ec2_key=AKIAXXXXXXXXX
ec2_secret=XXXXXXXXXXX

just for testing purpose, create file /var/www/webpagetest/www/testRegions.php

<?php
require_once('./common_lib.inc');
require_once('./lib/aws/aws-autoloader.php');
  $instances = array();
  $key = GetSetting('ec2_key');
  $secret = GetSetting('ec2_secret');
  if ($key && $secret) {
    try {
      $ec2 = \Aws\Ec2\Ec2Client::factory(array('key' => $key, 'secret' => $secret, 'region' => 'us-east-1'));
      $regions = array();
      $response = $ec2->describeRegions();
      if (isset($response['Regions'])) {
        foreach ($response['Regions'] as $region)
          $regions[] = $region['RegionName'];
      }
    } catch (\Aws\Ec2\Exception\Ec2Exception $e) {
      $error = $e->getMessage();
      EC2LogError("Listing running EC2 instances: $error");
    }
  }
echo $response;
?>

and trigger it by

php testRegions.php

Expected result

It should show what came from available regions

Actual result

Error happen described earlier

@DmitriyStoyanov DmitriyStoyanov added the Type: Bug An issue or pull request relating to a bug in WebPageTest label Dec 27, 2024
@DmitriyStoyanov DmitriyStoyanov changed the title Aws sdk failed in 24.12 release Uncaught TypeError in Aws sdk in 24.12 release Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug An issue or pull request relating to a bug in WebPageTest
Projects
None yet
Development

No branches or pull requests

1 participant