craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.26k stars 634 forks source link

[4.x]: Queue does only run when cp is openend in headless cms. Grapqhl requests do not trigger queue #15815

Closed The-Dan-Main closed 3 weeks ago

The-Dan-Main commented 3 weeks ago

What happened?

Description

We started to build quite a lot of headless craft cms and figuered, that the queue seems to run only, when we enter the cp. Is it possible, that the queue is not triggered on a graphql request?

Steps to reproduce

  1. install craft cms 4

  2. add variables to .env: CRAFT_ENABLE_GQL=true CRAFT_ALLOW_GRAPHQL_ORIGINS=false CRAFT_HEADLESS_MODE=true

  3. Install formie or freeform and send via mutation a form submittion.

  4. The email then goes to the queue, but the queue does not run.

Expected behavior

Queue should as well run, when graphql is requested

Actual behavior

queue waits for me to enter the cp

Craft CMS version

4.11.4

PHP version

8.3.11

Operating system and version

Plesk Obsidian with Debian Base

Database type and version

mariadb 10

Image driver and version

No response

Installed plugins and versions

i-just commented 3 weeks ago

Hi, thanks for getting in touch!

This is expected behaviour. As per the docs, by default, the queue is run automatically over HTTP, and it is skipped for Ajax requests and responses that produce something other than HTML.

There are other ways to run the queue, though. You can find more info on that here.

I hope this helps!

I’ll close this now, but feel free to get in touch again if you have further issues.