Closed ANTGOMEZ closed 5 months ago
From my experience it's very rare that something stops working when there have been "no changes anywhere".
This needs debugging from your end as there's very little help I can provide for your setup given I'm not your DBA. I can't see anything from what you've said that this would be an issue with the SQL client.
Things that spring to mind:
I see that your config has a request timeout of 15 minutes, so your system is used to requests taking a very long time, I'd aim to investigate the route cause of this as 15mins is a fairly undesirable duration for requests to the database to go through - perhaps your inserts are now taking 15 mins and 1 second and so are timing out?
It is difficult to debug the root cause of timeouts from the client side because the timeout is a client side feature; the library sets a timer and, if no response to the request is received before the timer expires, the request is aborted and an error raised. You'd have to interrogate the SQL server to understand better what is going on.
Runnung from AWS Lambda mssql hanging at the point of executing insert command
Expected behaviour: Expect Inserts to insert data into table when called through mssql
Actual behaviour: Hangs during insert and subsequently times out. It's an insert to the same table always. Has always worked until now.
We've been running an AWS Lambda that connects to an Onprem SQL Server DB and makes an Insert into a table (below). Has been running for years like this without issues. All of a sudden, this just stopped working. The insert hangs at the point that the code attempts to execute the query. The odd thing is that after doing a trace, we can see that pool.connect() actually sends a validation query to the server (SELECT 1). Also, select statements work went sent through using the same code. The logs show: "executing query" but nothing beyond that and then Lambda times out. If we could see some kind of error that could tell us something, that would be nice, but mssql just times out.
Ran below code on an independent Linux server on AWS and it behaves the same way, get ETIMEOUT.
I did try getting a verbose log from mssql but it's not helpful, just shows that dependent libraries executed. Like this
DEBUG=mssql:* node app.js
Now, if I send a smaller insert statement, then it works. But like I said before, the full insert had been working for years. And, no, there are no syntax errors that would cause a failure or something.
Configuration:
Here's the entirety of the code used to connect and exec queries:
This is the table, 114 columns:
Here's the same config we've always used and worked just fine:
{"user": "usx", "password": "psx", "server": "X.X.X.X", "database": "MYDB", "port": 1433, "trustServerCertificate": true, "connectionTimeout": 900000, "requestTimeout": 900000, "pool": {"max": 10, "min": 0, "idleTimeoutMillis": 10000}}
Software versions