-2

I have installed aws-php-sdk in Laravel and configured it correctly where putitem / getitem working when executing through HTTP/HTTPS in the browser and curl. However, when I try to execute the same script through Laravel queue, I am getting this exceptions when trying to instantiate aws client:

local.ERROR: App\Jobs\processjob::failed(): Argument #1 ($exception) must be of type App\Jobs\Throwable, Error given, called in /var/www/html/myappname/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php on line 260 {"exception":"[object] (TypeError(code: 0): App\Jobs\processjob::failed(): Argument #1 ($exception) must be of type App\Jobs\Throwable, Error given, called in /var/www/html/myappname/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php on line 260 at /var/www/html/myappname/app/Jobs/processjob.php:46)

I am using AWS role permission to access dynamodb. I have tried to debug for hours with no luck. Please help!

1
  • Please provide enough code so others can better understand or reproduce the problem. Commented Apr 20, 2023 at 23:59

1 Answer 1

0

The issue is very simple, processjob class has a failed method (overriden), and it is asking for Throwable $exception, your issue is that Throwable was not imported like a global class (\Throwable) so the PHP thinks it is a class local to the current namespace (App/Jobs).

So, your code should be like this:

function failed(\Throwable $exception)

or, another solution is:

On top of the file (after the namespace keyword), write this: use \Throwable;.

If this does not fix your problem, let me know and share your processjob class, but this should do it...

Sign up to request clarification or add additional context in comments.

1 Comment

Adding the failed method helped but now getting a different error: /var/www/html/myapp/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(159): GuzzleHttp\\Promise\\TaskQueue->run() Like before, going through the browser works but through the processjob fails with the above error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.