cURL Error #:Unknown SSL protocol error

quotedquoted Posts: 15Member
Hi,

I'm running into a problem with a synch script that has been active for a few months without any problem.
The error being returned is:

cURL Error #:Unknown SSL protocol error in connection to api.lightspeedapp.com:443


What could be the reason for this sudden change?
Any idea on how it can be fixed?

Thank you.

7 comments

  • Adrian SamuelAdrian Samuel Posts: 515Moderator, Lightspeed Staff moderator
    Hey @quoted, would you be able to provide us a copy of your request minus the tokens, clientID and secret 

    Adrian Samuel

    API Integrations Consultant - Strategic Solutions

    Lightspeed HQ

  • quotedquoted Posts: 15Member
    $curl = curl_init();

    curl_setopt_array($curl, array(
    CURLOPT_URL => "https://api.lightspeedapp.com/API/Account/{$lightspeed_account_id}/Category.json?offset=0&limit=100&orderby=categoryID",
    CURLOPT_HTTPHEADER => array(
        "Authorization: Bearer {$lightspeed_access_token}"
    ), 
    CURLOPT_RETURNTRANSFER => true
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);
    curl_close($curl);

    if ($err) {
    echo "cURL Error #:" . $err;
    }
  • gregaricangregarican Posts: 306Member 
    edited November 2018
    It could be the deprecation of TLS 1.0 on the LS API end. See https://community.lightspeedhq.com/en/discussion/783/any-plans-on-deprecating-tls-1-0-and-1-1 for specifics.

    You can explicitly state to use a higher TLS version in the CURL command line. For my Windows client the command line switch of --tlsv1.2  will force my client to make the connection using TLS 1.2, for example. As long as I have that library available on my computer. If you are using a Windows client, upgrading to newer .NET versions should automatically force the higher TLS version as default. 
  • quotedquoted Posts: 15Member
    I'm working in PHP on a Linux webserver. 

    I just tried to set TLS 1.2 using a command explained here:
    https://stackoverflow.com/questions/30145089/tls-1-2-not-working-in-curl

    Unfortunately this blocks the script from working at all (just keeps on loading). 

    Dit anything change last night?
    Never got any of these problems before, script has been running every 10 minutes since two months without any problem.

    Any other ideas? I'm kinda stuck at the moment :-(
  • gregaricangregarican Posts: 306Member 
    If you trace the traffic you should see in the request header what TLS version is being used. If yours says TLS 1.0 then that likely is the issue.
  • quotedquoted Posts: 15Member
    Tried different things in the meantime, script is not always reacting the same, making it very difficult to debug. SSL error seems to have disappeared now.

    Could the problems have something to do with the leaky bucket limits?
  • gregaricangregarican Posts: 306Member 
    Only a packet trace or inspection of the response headers and body would expose that I'd think. If it was API limits being hit I'd think you'd see an HTTP 429 - Too Many Requests type of error right off the bar. Strange that it's intermittent...  
Sign In or Register to comment.