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

TypeError: request is not a function #363

Closed
Bastes opened this issue Oct 17, 2017 · 6 comments
Closed

TypeError: request is not a function #363

Bastes opened this issue Oct 17, 2017 · 6 comments

Comments

@Bastes
Copy link
Contributor

Bastes commented Oct 17, 2017

I'm trying to get airbrake to work on a worker project I have (no web server, not even an api, just a simple worker that does its stuff repeatedly in its own process):

Here's what I did:

// package.json
"airbrake-js": "^0.9.8"
// ...
const airbrakeJs = require('airbrake-js');
const airbrake = new airbrakeJs.Client({projectId: PROJECT_ID, projectKey: PROJECT_KEY});
airbrake.notify('Silly uncaught exception');

And here's what I get:

/src/node_modules/airbrake-js/dist/client.js:1250
    request({
    ^

TypeError: request is not a function
    at report (/src/node_modules/airbrake-js/dist/client.js:1250:5)
    at /src/node_modules/airbrake-js/dist/client.js:447:17
    at Client.processor (/src/node_modules/airbrake-js/dist/client.js:642:5)
    at Client.notify (/src/node_modules/airbrake-js/dist/client.js:434:14)
    at Historian.notifyNotifiers (/src/node_modules/airbrake-js/dist/client.js:1502:22)
    at Historian.notify (/src/node_modules/airbrake-js/dist/client.js:1491:18)
    at process.<anonymous> (/src/node_modules/airbrake-js/dist/client.js:1458:23)
    at emitOne (events.js:115:13)
    at process.emit (events.js:210:7)
    at process._fatalException (bootstrap_node.js:329:26)

Since my keys work (tested in a ruby script) and I have followed what I found on the README, I'm guessing something might be wrong with airbrake-js itself ; my money would be on:

// airbrake-js's package.json
// ...
"devDependencies": {
// ...
  "@types/request": "^2.0.2"
// ...
}
...

(because a dev dependency should not be needed in the running sources)

Since I'm a bit new to nodejs and its requirements, I'm not sure though ^^° I'd send a pull request if I was, but I'm probably going to fork and play with this just to see if I can get it to work

@Bastes
Copy link
Contributor Author

Bastes commented Oct 17, 2017

Well, adding the "@types/request@2.0.2" dependency in my project didn't help, I'm still getting the same error -_-

@vmihailenco
Copy link
Contributor

I guess you need to install https://github.com/request/request:

npm install request

@Bastes
Copy link
Contributor Author

Bastes commented Oct 17, 2017

@vmihailenco Hi, thanks for the reply ^^ I'm trying it and letting you know.

@Bastes
Copy link
Contributor Author

Bastes commented Oct 17, 2017

@vmihailenco So, it works with request ^^ thanks. Mind if I send a PR with something in the README about it? (any advice on where it should go too?)

@vmihailenco
Copy link
Contributor

PR is welcome - I think a note in https://github.com/airbrake/airbrake-js#setup section will be enough...

@Bastes
Copy link
Contributor Author

Bastes commented Oct 17, 2017 via email

@Bastes Bastes closed this as completed Oct 17, 2017
Bastes added a commit to Bastes/airbrake-js that referenced this issue Oct 17, 2017
vmihailenco added a commit that referenced this issue Oct 17, 2017
Added a note about request dependency for issue #363
dazralsky pushed a commit to dazralsky/airbrake-js that referenced this issue Aug 21, 2023
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

2 participants