2

I'm creating a managed package which requires a namespace. It has a REST endpoint where it receives data from Twilio. Here's the error message I'm getting (on the Twilio dashboard).

Error - 11235 Certificate Invalid - Domain Mismatch

Twilio tried to validate your SSL certificate but your certificate has a domain name that does not match the domain we requested.

Possible Causes Your Certificate Name or Certificate Alternate Name on your SSL certificate does not match the domain Twilio requested.

Possible Solutions Obtain a SSL certificate with a Certificate Name or Certificate Alternate Name that matches this domain

And the URL it sent the request to is correct:

https://[instance].force.com/services/apexrest/[my namespace prefix]/IncomingData?[params]

I have a class that is a REST endpoint, which requires annotation at the very top of the class:

@RestResource(urlMapping='/IncomingData/*')

According to this reference info,

The URL mapping is relative to https://instance.force.com/services/apexrest/

Since I'll have a namespace, the endpoint will be https://[instance.force].com/services/apexrest/[namespace prefix]/IncomingData/*

I figured I could just use a wildcard for the namespace prefix, like this:

@RestResource(urlMapping='/*/IncomingData/*')

But that's not working. I also had the same error with no wildcard. I ran this with no issue in a namespaced dev org and didn't have to pre-pend the namespace or use a wildcard, and I also didn't need it in the Managed Package Beta. Maybe it's something else.

Questions boil down to these:

  1. Since I didn't need the wildcard when running in a namespaced dev org and the managed package (beta), do I need it here in the managed package (release)?
  2. If I don't need the namespace or wildcard in the URLmapping, then what is causing the "domain mismatch", and why hasn't that shown up prior to the managed package?
  3. Do I need some additional SSL certificate for a managed package?
  • This error is coming from twilio. Have you created any self signed certificate – Avijit Chakraborty Apr 27 '18 at 0:39
  • Hi Pat, After installing the managed package in an unrelated org , where you able to invoke that in any tools like Workbench / SOAP UI / Postman? if so could you tell us if you are getting the same error message ? – freaker87 Apr 27 '18 at 9:06
2

Thanks @Avijit and @freaker87, I appreciate the response. I have figured out (through trial and error) how to fix it, though I don't really understand the reason.

The error I was getting was the same as if I had a typo in the URL, so I suspected that the SSL error was simply because it was going to the wrong URL. Eventually, I tried changing from https:// to http:// ... and it works. NOTE: this will not work on the dev org or scratch orgs I used when building it. They require https://.

Luckily, Twilio allows you to specify an endpoint, and a fallback endpoint in case the first doesn't work, so I altered my code to set the first to http:// and the fallback to https://. Now it works for either kind of org.

BTW, the site I set up to receive the incoming GET is set to Require Secure Connections (HTTPS), and Upgrade all requests to HTTPS.

Salesforce MVP Daniel Peter had referred me to this post on the Dev Forum that says you need to add secure. before force.com to make an https:// request work. I tried it, and it works on the enterprise org with the managed packaged, but not on the dev or scratch orgs.

I'm curious whether this discrepancy is due to the Managed Package aspect, or some intrinsic difference in the orgs?

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.