mysqljs / mysql

A pure node.js JavaScript Client implementing the MySQL protocol.
MIT License
18.27k stars 2.52k forks source link

The AWS Lambda returns "Error: connect ETIMEDOUT **.****.***.***:443" #2517

Closed acabun closed 2 years ago

acabun commented 3 years ago

I have to services, Admin Panel(Laravel) и Online Shop(Woocommerce). TH relation between these to services was realized with "AWS Lambda"

when I try to send an updating product request from my ADmin panel to online shop, time to time the lambda couldn't connect to the Woocomerce API. On time when the system is not updating the product, lambda returns the error "Error: connect ETIMEDOUT"

I originally thought that the Wordpress didn't have enought time for updating process. And decided to increase the lambda's timeout (60000 ms). But it didn't help. I still found the ETIMEDOUT errors in logs.

By the way, the time period between sending the updating request to woocommerce and showing an error is 2 min. If I right understand, the lambda had enought time for getting the answer from woocommerce.

Another strage thing. According the lambda's logs, on time when lambda got an error, the woocommerce API was available. It seems like something disconnects the internet on time when lambda is sending the request.

My question is, why lambda cannot send to woocommerce API the reuqest. Why it happens time to time ?

P.S. Below I added the example of lambda's logs.


The log on starting sending the uptading request.

2021-08-14T18:23:48.692Z b228455b-45a8-5cbf-8160-1cc INFO Inside edit Online List { status: '1',


is_delete: 0, name: 'Omega Speedmaster Moonwatch Chronograph 42mm ', price_on_request: 0, on_sale: 0 }

The log with error.

2021-08-14T18:25:58.299Z b228455b-45a8-5cbf-8aae6 INFO WooCommerce editOnlineStock err::: { Error: connect ETIMEDOUT *.***..:443 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14) errno: 'ETIMEDOUT', code: 'ETIMEDOUT', syscall: 'connect', address: '.**.**.', port: 443, config: { url: 'https://domain.com/wp-json/wc/v3/products/*', method: 'put', params: {}, data: '{"name":"Omega Speedmaster Moonwatch Chronograph 42mm ","type":"simple"***', headers: { Accept: 'application/json', 'Content-Type': 'application/json;charset=utf-8', 'User-Agent': 'WooCommerce REST API - JS Client/1.0.1', 'Content-Length': 681 }, auth: { username: 'ck****', password: 'cs****' }, transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 60000, adapter: [Function: httpAdapter], responseType: 'json', xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN',


dougwilson commented 3 years ago

The error you provided above does not seem to be using this mysql library. Can you post the code that goes along with the error showing how you are using thia module?

acabun commented 3 years ago

Sorry, you're right. Didn't see in which branch I added the question. But, maybe you can help pen with my question

dougwilson commented 3 years ago

I may be able to, but just need to see how you wrote the mysql client code so I can understand what may need to be changed/adjusted in it.

dougwilson commented 2 years ago

Closing due to no response.