Skip to content

Error: Global connection already exists. Call sql.close() first. #616

@braco

Description

@braco

I'm wrestling with an aws lambda and mssql.

It seems like there's some kind of error event that exits but doesn't close the connection, so the next request is met with:

Error: Global connection already exists. Call sql.close() first. From here

It seems important to be able to check for the existence of globalConnection, but there doesn't seem to be a getter, correct? Something like the following would help:

// Turn off this error and just return the existing globalConnection
sql.connect({ reuseConnection: true })
sql.connect()

// Just a getter for globalConnection
sql.getConnection()

if (sql.connectionStatus() === CONNECTED) { ... }

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions