Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

amitsolanki24_'s avatar

Trigger queue-jobs API from different project

Strange Issue: Queue Jobs Being Dispatched to the Wrong Project

Hey everyone,

I'm facing a strange issue with queue jobs in my Laravel projects, and I can't figure out why it's happening.

Project Setup:

I have two Laravel projects running locally:

  • Project P1http://localhost/p1
  • Project P2http://localhost/p2

In P1, I have an API endpoint:

api/queue/TaskRun

This API is responsible for dispatching queue jobs in P1.

The Issue:

  • When I trigger api/queue/TaskRun from P2, the jobs are wrongly inserted into P2's jobs table instead of P1's.
  • However, when I trigger the same API from Postman or directly from P1, the jobs are inserted correctly into P1's jobs table (as expected).

What I Have Checked:

  • The queue connection and database settings in config/queue.php for both projects.
  • Ensured that QUEUE_CONNECTION in .env is correctly set in P1.
  • Double-checked the API request URL to confirm it’s hitting P1 and not P2.

Has anyone faced a similar issue? Any ideas on why P2 is handling the jobs instead of P1?

Any help would be greatly appreciated!

Thanks in advance!

0 likes
6 replies
martinbean's avatar

Any solution?

@amitsolanki24_ You don’t actually say what the problem is. How can any one give you a “solution” to a problem you don’t describe? 🤷‍♂️

1 like
amitsolanki24_'s avatar

@martinbean I have updated my post, Please check.

problem is that when I run api from p2 project its storing jobs into p2 jobs table instead of p1 jobs table.

but when I call api from postman it's storing jobs into p1 jobs table that is correct.

amitsolanki24_'s avatar

@martinbean it's not a completely different project.

It's a main domain and I'm calling API from subdomain.

I can't run queue jobs on all subdomain due to server resources.

Please or to participate in this conversation.