+ Start a Discussion
yarddefenderyarddefender 

Named Credentials Internal Server Error

I am attempting to use Named Credentials in a method that returns a Continuation, but immediately receive an Internal Server Error when the Continuation method is called. The method that makes the call looks like this:
 
public Object startRequest() {

		// Create continuation with a timeout
		Continuation con = new Continuation(90);
		// Set callback method
		con.continuationMethod = 'processResponse';

		// Create callout request
		HttpRequest req = new HttpRequest();
		req.setMethod('GET');
		req.setEndpoint('callout:Netsuite/getCustomerById?customerId=' + opp.Account.Netsuite_ID__c);

		// Add callout request to continuation
		this.requestLabel = con.addHttpRequest(req);

		// Return the continuation
		return con;
	}

My Named Credential uses Named Principal Identity Type with Password Authentication. I am going to switch to using custom settings if this can't be resolved, but figured I'd check to see if anyone else has experienced something similar.

Thanks!
ShashankShashank (Salesforce Developers) 
Would you be able to post the internal server error number so that I can try looking up internally?
ShashankShashank (Salesforce Developers) 
From what I checked internally, Named Credentials are not supported in Continuation Calls and hence you are seeing the error. There are plans to include support in a future release, however, timelines are not fixed.
AlejandroRaigonAlejandroRaigon
For future reference, named credentials are supported in continuation calls since Summer '16.