amrav / restify-jwt

restify middleware that validates a JsonWebToken (JWT) and sets the req.user with the attributes
Other
83 stars 30 forks source link

TypeError: restify.InvalidCredentialsError is not a function #21

Open jonatasfreitasv opened 6 years ago

jonatasfreitasv commented 6 years ago
node_modules/restify-jwt/lib/index.js:71
        return next(restify.InvalidCredentialsError('No authorization token was found'));
                            ^

TypeError: restify.InvalidCredentialsError is not a function
    at middleware (/home/jonatas.freitas/Projects/rta_api/node_modules/restify-jwt/lib/index.js:71:29)
    at call (/home/jonatas.freitas/Projects/rta_api/node_modules/restify/lib/chain.js:164:9)
    at next (/home/jonatas.freitas/Projects/rta_api/node_modules/restify/lib/chain.js:120:9)
    at Chain.run (/home/jonatas.freitas/Projects/rta_api/node_modules/restify/lib/chain.js:123:5)
    at Server._runUse (/home/jonatas.freitas/Projects/rta_api/node_modules/restify/lib/server.js:976:19)
    at Server._runRoute (/home/jonatas.freitas/Projects/rta_api/node_modules/restify/lib/server.js:918:10)
    at Server._afterPre (/home/jonatas.freitas/Projects/rta_api/node_modules/restify/lib/server.js:888:10)
    at Immediate.preChainDone [as _onImmediate] (/home/jonatas.freitas/Projects/rta_api/node_modules/restify/lib/server.js:856:14)
    at runCallback (timers.js:791:20)
    at tryOnImmediate (timers.js:747:5)
gdereese commented 6 years ago

I'm also getting this error.

gdereese commented 6 years ago

@jonatasfreitasv Looks like this issue is fixed in the repository code, but a new version hasn't been published to npm for some time that includes this fix.

See issue #20; someone pointed out a fork of this project that is more current. I substituted this package for that one and no longer experienced the above issue.

zgr024 commented 6 years ago

I have submitted a pull request that will resolve the issue by using restify-errors for all error handling instances that were using restify.[errorHandler]. It looks like this package is no longer maintained for use with restify > 4.x