getContentAsPDF() is returning Internal Salesforce.com Error when called from a webservice. I have a webservice defined which essentially creates a BLOB from a visualforce page generated as a pdf and then returns the same as response payload.

I am getting this response back in the webservice : "401 status code return from request to https://xxx.salesforce.com/apex/clientagreement?ids=xxxxxxxxxxxxxx&inline=1",

In my debug I get a Internal Salesforce.com Error on the same line as the method getContentAsPDF is being called.

However, when I run the exact code from Developer console anonymous window providing the exact same parameters, the code is executing correctly.

Has anyone faced a similar issue?

  • Is the web service a public API (e.g. on a Site)? The error indicates you don't have an active session. That said, the documentation does also mention that you can't use the method in some contexts, but web services is not one of them. I suspect it simply may not be allowed, despite the documentation. – sfdcfox Feb 28 '18 at 20:24
  • Also, do you have an error code ("gack")? If so, please put it in the question, I'll ask my contacts. – sfdcfox Feb 28 '18 at 20:25
  • This works in my dev org. The problem is likely not specifically the page itself, but something the page is doing. A gack is necessary for us to help you further. – sfdcfox Feb 28 '18 at 20:33
  • @sfdcfox : There is no error code returned. I just get 14:16:05.579 (1579430085)|FATAL_ERROR|Internal Salesforce.com Error. It is being called from a rest api webservice class declared as global. The exact same works in my higher environments. I initially thought it may be a difference in Salesforce release, but both my sandboxes are in Spring 18. – ParoTech Feb 28 '18 at 20:50

Your Answer

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

Browse other questions tagged or ask your own question.