microsoft / computervision-recipes

Best Practices, code samples, and documentation for Computer Vision.
MIT License
9.34k stars 1.16k forks source link

[ASK] SSL/TLS Handshake error while calling Azure Vision API #653

Closed abhinav82ify closed 2 years ago

abhinav82ify commented 2 years ago

Description

I have a spring boot based microservice in which I am using Microsoft Azure Computer Vision API to read data from a PDF file. After containerizing the microservice, the container works fine and I am able to send/receive data to/from Computer Vision API on my machine. But, when I run this container on an Azure based Linux Virtual Machine, the container cannot communicate with the Computer Vision API and throws exception java.lang.RuntimeException: javax.net.ssl.SSLKeyException: RSA premaster secret error. Also, the spring-boot jar is able to communicate with Azure on VM and throws no such exception.

Do you think I need to pass any self-signed certificate to the container for it to be able to communicate smoothly?

I think the biggest advantage of using these containers is that it makes the code platform independent. So, why is this error thrown only on Azure VM and runs completely fine on my machine? Please advise.

abhinav82ify commented 2 years ago

I was able to find out what the error was. There was nothing wrong with the JDK/JRE setup. The issue arose due to the version of docker engine installed on the Azure VM.

Azure based computer vision APIs required server to be TLS1.2 compliant, whereas the version of the docker engine installed on my machine was older and did not support TLS1.2. I was able to fix it after upgrading the docker engine to the latest version.