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?
@RemoteAction
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) {
system.debug(labels);
for (string l : labels) {
system.debug(l);
HttpResponse response = Continuation.getResponse(l);
system.debug(response);
}
...
}
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
HttpResponse response = Continuation.getResponse((String)state);
and have method parameter as state only? likeglobal static Object callback(Object state)
global static Object callback(Object state)
signature.