Connecting To A Custom API

Hello Bubble friends,

My team and I have built a custom backend API and are trying to connect our Bubble app to it via the Bubble API Connector. We are getting this error:

There was an issue setting up your call.

Raw error for the API
{“message”:“unable to verify the first certificate”,“args”:{“origin”:“native error”,“code”:“UNABLE_TO_VERIFY_LEAF_SIGNATURE”,“outer_stack”:{“message”:".wait() was called here",“args”:{},“stack”:“UnexpectedError .wait() was called here\n at Block.wait (/home/ec2-user/bubble/lib/u/u.js:1435:22)\n at Promise.block (/home/ec2-user/bubble/lib/u/u.js:2289:18)\n at /home/ec2-user/bubble/lib/apiconnectorbase.js:1518:43\n at Function.Lib.extend (/home/ec2-user/bubble/lib/lib.js:284:14)\n at TestAPICall.calls.TestAPICall.TestAPICall.execute (/home/ec2-user/bubble/lib/apiconnectorbase.js:1485:20)\n at /home/ec2-user/bubble/lib/server/services/api_service.js:41:18\n at Function.Lib.extend (/home/ec2-user/bubble/lib/lib.js:284:14)\n at APIService.module.exports.APIService.doapicallfromserver (/home/ec2-user/bubble/lib/server/services/api_service.js:20:16)\n at APIService.module.exports.APIService.post (/home/ec2-user/bubble/lib/server/services/api_service.js:13:26)\n at ServiceHoster.module.exports.ServiceHoster._call_service (/home/ec2-user/bubble/lib/server/services/service_hoster.js:585:26)\n at ServiceHoster.module.exports.ServiceHoster.request (/home/ec2-user/bubble/lib/server/services/service_hoster.js:606:16)\n at ServiceHoster.module.exports.ServiceHoster.do_request (/home/ec2-user/bubble/lib/server/services/service_hoster.js:160:16)\n at /home/ec2-user/bubble/lib/server/services/service_hoster.js:80:25\n at Function.Lib.with_lib (/home/ec2-user/bubble/lib/lib.js:238:12)\n at /home/ec2-user/bubble/lib/server/services/service_hoster.js:49:22\n at run_fn (/home/ec2-user/bubble/lib/u/u.js:1162:9)\n”}},“stack”:“Error: unable to verify the first certificate\n at TLSSocket.onConnectSecure (_tls_wrap.js:1051:34)\n at TLSSocket.emit (events.js:189:13)\n at TLSSocket.EventEmitter.emit (domain.js:441:20)\n at TLSSocket._finishInit (_tls_wrap.js:633:8)\n”}

Could you please explain why we are getting this error and how to resolve it?

Thank you!

Normally mean that the API server doesn’t have a valid certificate (HTTPS).
Check your Custom API server configuration to be sure they have a valid certificate or maybe try using http if available

Is the Bubble API Connecter A Plugin?

Yes, it is a plugin.

Interesting, I thought our certificate was valid. We are using https. Does it have to be a certain type of certificate? (ie. EV SSL, OV SSL, or DV SSL)?

I don’t think this need a specific type but not sure. Maybe there’s some tool that will tell you exactly what you need to fix on server side like a certificate checker.
You can also try to add a user-agent header. In some case this may help too. There’s no way actually in Bubble to bypass this, but if you try to connect your API in Integromat, Integromat have an option to ignore the certificate check. So you can try with it enable and not and check if you have the same issue. So it will be confimed that it’s coming from your server settings.

I’ve tested it on postman and it works and it also works in the browser and is loaded with https. We are certifying the API using “Lets Encrypt” (https://letsencrypt.org/) which is a very popular and proven certificate tool. For these reasons, this error perplexes me.

Also, thank you very much for helping us figure this out Jici!

If you can share (PM) a get url that you have this issue , I can help trying to debug.

Here is what we’re trying:
https://legitimizer.co:2000/api?version=0&endpoint=search&q=rocket+cleaner
And we’re using Let’s Encrypt to create the certificate.

Hey. I’m Thor Lancaster, the back-end programmer for team Legitimizer. I believe our issue is being caused by my Java-based server not providing the intermediate CA certificate that is required for non-browsers to successfully complete the HTTPS handshake.
After adding the intermediate CA to my certificate object, the new version (on port 2001) appears to be working, at least when using cURL (it wasn’t before).

We got it working! Thank you for all the help.