I have a working version of using an apex continuation in a VF page for parallel and chained callouts. Now I need to use a continuation from a Lightning Component so I implemented the Continuation Proxy component from the Salesforce Developers Blog. I can attach multiple HTTP requests to the continuation and I have confirmed all requests reach my server and complete successfully. I have confirmed the continuation calls my callback method.

In the callback method, Continuation.getResponse(requestlabel) always returns null. requestlabel has a valid value too, "Continuation-1".

I have tested the ContinuationProxy in a lightning component app and on a record detail page.

This is failing in a sandbox org with a domain set.

This code does work correctly in a developer org, meaning, it seems to be failing in this sandbox org only.

Has anyone seen this before or can help me in the right direction?

global static Object invoke(String methodName, String[] params) {

    // Create a Continuation for the HTTPRequest        
    Continuation con = new Continuation(60);
    con.continuationMethod = 'callback'; 

    //Add http request to continuation

    return con;

global static Object callback(list<string> labels, Object state) {
    for (string l : labels) {
        HttpResponse response = Continuation.getResponse(l);


13:53:04.0 (1053483)|USER_DEBUG|[160]|DEBUG|(Continuation-1)
13:53:04.0 (1143478)|USER_DEBUG|[162]|DEBUG|Continuation-1
13:53:04.0 (1235817)|USER_DEBUG|[164]|DEBUG|null

  • What does label contain? Can you try getting the response as HttpResponse response = Continuation.getResponse((String)state); and have method parameter as state only? like global static Object callback(Object state) – Hemant Jain Feb 20 '18 at 6:00
  • The logs are shown at the bottom of the post for the three debug statements. My original attempt used the global static Object callback(Object state) signature. – Gerard Sexton Feb 20 '18 at 6:02

Only with a managed package could I reproduce the issue.

I needed to pass a continuation to a class in a managed package. The class then created a web request and added it to the continuation object.

I first tried for unpackaged code to create the HTTP request and have packaged code add it to the continuation but that did not work.

The solution is for unpackaged code to create and add the request to the continuation. The packaged code should just set the request properties.

| improve this answer | |

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.