1

In Spring 17, I saw in the release notes (https://releasenotes.docs.salesforce.com/en-us/spring17/release-notes/rn_apex_chaining.htm?edition=&impact=) that we can now chain Queueable Jobs that make Callouts. However, when implementing this myself, I am receiving the following error:

Maximum stack depth has been reached.

This error is thrown when I System.enqueue() the next Job.

I implemented this assuming it would work from the release notes. I have tried updating the metadata of the class to version 39.0. Are there any other configurations that may be restricting the chained callout?

  • I just tried from my dev org. I too hit a FATAL_ERROR System.AsyncException: Maximum stack depth has been reached. exception for the 6th chained job. Maybe raise a support case? The first 5 requests made it to requestbin. The 6th did not. – Daniel Ballinger Jun 2 '17 at 0:40
  • Yeah I think you are right. I actually ended up implementing the Queueable-Future-Queueable pattern for now to get my Google Maps integration working. But I think I will raise a support case because I will want to do this in the future. Thanks. – Jon Duelfer Jun 2 '17 at 9:50
1

From Trailhead:

No limit is enforced on the depth of chained jobs, which means that you can chain one job to another job and repeat this process with each new child job to link it to a new child job. However, for Developer Edition and Trial orgs, the maximum stack depth for chained jobs is 5, which means that you can chain jobs four times and the maximum number of jobs in the chain is 5, including the initial parent queueable job.

The same details are also in the Queueable Apex docs.

What they don't cover is how to actually detect this in a Developer Edition org. At this stage I'm just catching the System.AsyncException exception, checking the message is 'Maximum stack depth has been reached.' and then bouncing it through a future method to queue them up again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.