2

I have a Queueable class that performs a single callout. When it executes, it generates this error:

HttpCallout.TooManyCalloutsException: Too many callouts requested vs SFDC Limit: 0

public class MyQueueable implements System.Queueable{
    
    public void execute(QueueableContext qc) {
        system.debug('callout limits='+ Limits.getLimitCallouts()); // <= displays 0
        
        ... do a callout here
    }
}
  • How can the SFDC callout limit be zero?
  • Where is this documented?
  • How do I resolve this?

1 Answer 1

5

Posting this as Q&A because if you actually Google (as of this writing):

"HttpCallout.TooManyCalloutsException: Too many callouts requested vs SFDC Limit: 0" 

you don't get any matches.

Synchronous Web service callouts are not supported from scheduled Apex. To make asynchronous callouts, use Queueable Apex, implementing the Database.AllowsCallouts marker interface.

The solution is to add Database.AllowsCallouts to your Queueable class definition

public class MyQueueable implements System.Queueable, Database.AllowsCallouts {

  public void execute(QueueableContext qc) {
    system.debug('callout limits='+ Limits.getLimitCallouts()); // <= displays 100
    
    ... do a callout here
  }

}

Note that if an outer class implements Database.AllowsCallouts, this is not inherited by any inner class that implements System.Queueable

1
  • The clue is definitely in the limit of 0... but you are right, this requires some experience to understand.
    – Phil W
    Commented Jun 4, 2022 at 9:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .