MONEI / Shopify-api-node

Node Shopify connector sponsored by MONEI
https://monei.com/shopify-payment-gateway/
MIT License
940 stars 278 forks source link

SSL alert number 40: handshake_failure #619

Closed billpham39 closed 5 months ago

billpham39 commented 12 months ago

Hello there,

My application is using shopify-api-node version 3.5. So far, my application is having connection issue while trying to establish connection to scrap shopify stores data. Here is the error:

handleTask(): Quick Retry: Error: write EPROTO 139946805460296:error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1544:SSL alert number 40 : undefined - undefined at ShopifyClient.<anonymous> (/var/server/app/packages/sip-common/dist/client/shopify/parse-error.decorator.js:81:27) at Generator.throw (<anonymous>) at rejected (/var/server/app/packages/sip-common/dist/client/shopify/parse-error.decorator.js:25:65) at runMicrotasks (<anonymous>) at processTicksAndRejections (internal/process/task_queues.js:97:5)

The configuration is like this: Shopify.IPublicShopifyConfig = { accessToken: accessToken, shopName: tenantId, apiVersion: apiVersion, presentmentPrices: !!enablePresentmentPrices, autoLimit: true, timeout: 120000, };

I'm trying to investigate to find the root cause, but the problem seems to happen randomly with many different stores for examples:

fyorshoes.myshopify.com
brands-world-ca.myshopify.com

Their CA is issued by Let's Encrypted. I would greatly appreciate for your suggestion.

Many thanks, Bill

lpinca commented 12 months ago

According to Google, the SSL alert number 40 error happens when the client omits the server name for the SNI TLS extension but the server name is added automatically by Node.js so I guess a proxy between you and the upstream server does not correctly forward it.

billpham39 commented 11 months ago

Thank you for your suggestion, @lpinca . I've done some tests to investigate the issue, as I mentioned the problem happens randomly. I can reproduce the error with old openssl version, but can't with vTLS 1.2 (mine is running with vTLS 1.2). I tend to blame openssl version and the api node. This error is so vague to be honest.

lpinca commented 5 months ago

I'm closing this due to inactivity.