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

potentdevelopment's avatar

Running API Calls From Jobs Issue

So we have an API call to to our Magento application which is called in a Job. I'm running into a weird situation where when the job is executed, the response has no data. We've already confirmed that the API works when we execute it in a controller or a command via the command line. When run from a job, $response shows nothing in the log or the dd().

$magento = new Magento();
        $response = $magento->api('Customers')->isCustomerAvailableByEmail("[email protected]");
       
        Log::debug('Magento returned data, ' . $response->json());
        dd($response->json());
0 likes
3 replies
bobbybouwmann's avatar

Mmh, do you have some more context on how you're calling your job?

Also, did you verify if the job works without the call to the API? Does it log anything if you just call an empty job?

potentdevelopment's avatar

@bobbybouwmann Yes the job runs. It will log "Magento returned data, " and just blank afterwards. I'm also triggering the job by calling it in my test controller that I've setup.

Also, if I put dd("test") above the $magento = new Magento(); it will trigger but any dd() after the instantiation will not work. I've also verified that the API does work.

Please or to participate in this conversation.