Skip to content
Advertisement

Azure functions: Exception: TypeError: connection.query is not a function

I have a simple Azure function trying to get all data from a SQL table. The connection is successful and I can connect to the database, but whenever I run the get request, I end up with an error

This is the line throwing the error

this is my index.js azure get function

Am using tedious as the connection driver. my dbconfig

what am I doing wrong, thank you in advance

Advertisement

Answer

You should use Request to query.

In the official documentation, I did not see the usage of connection.query. It is not recommended that you use tedious when you are not very familiar with it. I have a sample code here, I hope it helps you.

You can download my Sample Code which use mssql package.

Test Result:

enter image description here

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement