Skip to content

Context lost after making the first call to odbc #18

@ranjithchev

Description

@ranjithchev
const app = require('express')();
const httpContext = require('express-http-context');
var db = require('odbc')();
const cn = "DRIVER={ODBC Driver 13 for SQL Server};SERVER=SOMESERVER,SOMEPORT;DATABASE=somedb;Trusted_Connection=Yes"

app.use(httpContext.middleware);

app.get('/', (req, res) => {
    httpContext.set('foo', 'bar');

    console.log(httpContext.get('foo'));      // prints 'bar'

    db.open(cn, (err) => {
        if (err) throw err;

        console.log(httpContext.get('foo'));  // prints undefined!
        ...
    });
});
...

My environment is

RedHat Enterprise Linux 7.2 (maipo)
Node: 6.9.1
npm: 5.6.0
express-http-context: 1.0.4 (have tried 1.0.0 as well)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions