craft-async-queue icon indicating copy to clipboard operation
craft-async-queue copied to clipboard

Jobs not running after upgrade to Craft 4

Open RandomJo opened this issue 1 year ago • 9 comments

AsyncQueue has stopped working on several sites after upgrading to Craft 4. When I run the AsyncQueue test, 10 jobs get added to the queue but none of them run after running ./craft queue/run in my terminal. When AsyncQueue is not installed, quick jobs do run after running the CLI command, including the AsyncQueue tests (after uninstalling and leaving the jobs there to be processed).

I do see this error when I run ./craft queue/run regardless of whether or not AsyncQueue is installed:

[ERROR] Queue must be an application component. yii\base\InvalidConfigException

It's possible it's related, but I'm having a hard time tracking down the source of that error message.

RandomJo avatar Sep 08 '22 22:09 RandomJo

Sorry, I wasn't able to reproduce it with Craft 4.1 (I'll try it with the latest after fixing my broken setup - yes, something like this happens to me too :-))

ostark avatar Sep 12 '22 12:09 ostark

Not able to reproduce it with Craft 4.2 either. I assume it is somehow related to your unique config/setup.

I do see this error when I run ./craft queue/run regardless of whether or not AsyncQueue is installed: [ERROR] Queue must be an application component. yii\base\InvalidConfigException

Async Queue runs ./craft queue/run under the hood. If this is broken, it will not work.

~10 lines of the stack trace might be useful to fully understand the issue.

ostark avatar Sep 12 '22 14:09 ostark

Must be something specific to our company project config then.

./craft queue/run works as expected when AsyncQueue is not installed. It gives that error message, but queue items process as expected. Unfortunately, Craft doesn't give me anything for the error other than what I copy/pasted. Do you know if there's a setting or something that would give me a more verbose stack trace? I also do not see anything more within storage/logs/queue.log.

RandomJo avatar Sep 12 '22 14:09 RandomJo

Maybe it is related to old Jobs in the queue (created by Craft 3)?

https://craftcms.com/docs/4.x/upgrade.html#performing-the-upgrade

Make sure you don’t have any pending or active jobs in your queue.

ostark avatar Sep 12 '22 14:09 ostark

I don't believe it's that. There are no jobs in the queue before I run load the AsyncQueue test jobs.

RandomJo avatar Sep 12 '22 15:09 RandomJo

We are going to do some more exploring on our end to see if we can isolate which part of our project config makes the difference. We'll report back later. Heads up that it may be another developer on my team who jumps back in.

RandomJo avatar Sep 13 '22 20:09 RandomJo

I think I solved the issue: https://github.com/ostark/craft-relax/releases/tag/2.0.1

(I assume you use the relax plugin too)

ostark avatar Sep 14 '22 14:09 ostark

Yes! We are using it for that project. We'll give this a try and let you know.

RandomJo avatar Sep 14 '22 20:09 RandomJo

@ostark Hopping in here for @RandomJo to confirm that the update to the Relax plugin did in fact fix our issue. Thanks for your help on this!

corneliusio avatar Sep 15 '22 14:09 corneliusio

@ostark we have the same issue here. Do we need 'runQueueAutomatically' set on true in Craft4? Relax ist not in use by the way :)

DavidKabelitz avatar Sep 20 '22 14:09 DavidKabelitz

@DavidKabelitz Does it happen in all environments? Does ./craft queue/run -v work for you?

ostark avatar Sep 20 '22 14:09 ostark

Nope, looks like we need to check some changes related to Craft4. So it's our fault. Thanks for the quick reply.

DavidKabelitz avatar Sep 20 '22 15:09 DavidKabelitz