question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Host crashes when using tedious to connect to a database.

See original GitHub issue

Please provide a succinct description of the issue.

Repro steps

Provide the steps required to reproduce the problem

  • Create a node http function
  • index.js
var Connection = require('tedious').Connection;  
var config = {  
    userName: 'username',  
    password: 'PASSWORD',  
    server: 'server.database.windows.net',  
    options: {encrypt: true, database: 'AdventureWorks'}  
};  

module.exports = function(context, req, saasSql) {

    var connection = new Connection(config);  
    connection.on('connect', function(err) {  
        if(err) {
            context.log(err);
        } else {
            context.log("Connected");  

            context.res = {
                body: 'Connected'
            };
        }
     context.done();
    });  
};
  • package.json
{
    "dependencies": {
        "tedious": "*"
    }
}
  • function.json
{
  "bindings": [
    {
      "authLevel": "function",
      "type": "httpTrigger",
      "direction": "in",
      "name": "req"
    },
    {
      "type": "http",
      "direction": "out",
      "name": "res"
    }
  ],
  "disabled": false
}
  • Hit run

Expected behavior

Error maybe, I don’t know

Actual behavior

w3wp.exe crashes

Known workarounds

none

Related information

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
fabiocavcommented, Sep 27, 2016

@mamaso just remove the .js from the link

0reactions
SameerDoshicommented, Aug 12, 2019

The syntax has changed for config section. See [Query Azure SQL from Node](https://stackoverflow.com_ Config now looks like:

var config =
{
    authentication: {
        options: {
            userName: 'userName', // update me
            password: 'password' // update me
        },
        type: 'default'
    },
    server: 'your_server.database.windows.net', // update me
    options:
    {
        database: 'your_database', //update me
        encrypt: true
    }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js tedious ConnectionError: Failed to connect ...
I have found the problem with my code... it was because I had a throw exception in the callback error for swmssqlc.connect() which...
Read more >
Mysql Workbench crashing when connecting
Go to Database -> Manage Connections · New -> Enter the connection details · Click test connection. · If credentials are OK and...
Read more >
MySQL crashes when connecting from localhost with tcp ...
I have Ubuntu 12.04 running MySQL server 5.5.24. I can connect with mysql --user root -p . status shows me : ... Connection:...
Read more >
node-mssql | Microsoft SQL Server client for Node.js
Short Example: Use Connect String. const sql = require('mssql') async () => { try { // make sure that any items are correctly...
Read more >
Getting started | Tedious
The arguments to the Connection constructor are host, username, password, an options object (empty in this example), and a callback function. Tedious will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found