Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trouble integrating with restify (require order, module not found error) #56

Open
dasantonym opened this issue Oct 19, 2015 · 2 comments

Comments

@dasantonym
Copy link

i wanted to set up pmx with restify (4.0.3) and i understood i need to include pmx before inclusion of any http related stuff happens. so since i want to make pmx optional (external config file) i happen to include it within an async waterfall during setup.

so when i include restify before pmx everything works (except for catching routes with pmx, i guess).

but when i include it like this:

// ...
        }, function (cb) {
            if (config.get.api_server.usePmx) {
                pmx = require('pmx').init({
                    http: true, // HTTP routes logging (default: true)
                    ignore_routes: [/socket\.io/, /notFound/], // Ignore http routes with this pattern (Default: [])
                    errors: true, // Exceptions loggin (default: true)
                    custom_probes: true, // Auto expose JS Loop Latency and HTTP req/s as custom metrics
                    network: true, // Network monitoring at the application level
                    ports: true,  // Shows which ports your app is listening on (default: false)
                    alert_enabled: true  // Enable alert sub field in custom metrics   (default: false)
                });
            }
            cb();
        }, function (cb) {
            var restify = require('restify'),
                server = restify.createServer({
// ...

i get this weird stacktrace and error:

/usr/local/bin/node --harmony app.js
Error: Cannot find module 'restify'
    at Function.Module._resolveFilename (module.js:337:15)
    at Function.Module._load (module.js:287:25)
    at Function._load (/Users/anton/WebstormProjects/piecemeta-api/node_modules/pmx/lib/transaction.js:62:21)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at /Users/anton/WebstormProjects/piecemeta-api/app.js:68:27
    at fn (/Users/anton/WebstormProjects/piecemeta-api/node_modules/async/lib/async.js:717:34)
    at /Users/anton/WebstormProjects/piecemeta-api/node_modules/async/lib/async.js:1170:16
    at /Users/anton/WebstormProjects/piecemeta-api/node_modules/async/lib/async.js:172:37
    at /Users/anton/WebstormProjects/piecemeta-api/node_modules/async/lib/async.js:677:43
    at /Users/anton/WebstormProjects/piecemeta-api/node_modules/async/lib/async.js:173:37
    at Immediate._onImmediate (/Users/anton/WebstormProjects/piecemeta-api/node_modules/async/lib/async.js:1163:34)
    at processImmediate [as _immediateCallback] (timers.js:368:17)

Process finished with exit code 255

so it is some load action in pmx/lib/transaction but i have no idea what it is supposed to be doing exactly. am i doing something wrong here?

EDIT: using node 4.2.1 on mac os x 10.11 with pmx version 0.5.5

@lklepner
Copy link
Contributor

Seems like you are experiencing the same issue as #34

Try installing the last know good version - [email protected]

@Unitech
Copy link
Member

Unitech commented Dec 8, 2015

Deactivate http monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants