Skip to content

Commit

Permalink
Merge pull request #387 from metrico/386_fix
Browse files Browse the repository at this point in the history
#fix: 386 fastify-auth is outdated
  • Loading branch information
akvlad authored Nov 10, 2023
2 parents ba97754 + 1858ac0 commit 8d770ea
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 113 deletions.
6 changes: 6 additions & 0 deletions lib/handlers/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ const handler = (err, req, res) => {
message: err.message
})
}
if (err.name && err.name === 'FastifyError') {
return res.status(err.statusCode).send({
statusCode: err.statusCode,
message: err.message
})
}
if (err.name && err.name === 'UnauthorizedError') {
return res.status(401).send({
statusCode: 401,
Expand Down
132 changes: 21 additions & 111 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"@fastify/static": "^6.12.0",
"@fastify/websocket": "^8.2.0",
"@fastify/url-data": "^5.4.0",
"@fastify/basic-auth": "^5.1.0",
"@qxip/influx-line-protocol-parser": "^0.2.1",
"@qxip/plugnplay": "^3.3.1",
"@stricjs/router": "^5.0.6",
Expand All @@ -49,7 +50,6 @@
"date-fns": "^2.27.0",
"fast-querystring": "^1.1.0",
"fastify": "^4.24.3",
"fastify-basic-auth": "^2.3.0",
"fastify-metrics": "^10.3.3",
"fastify-plugin": "^4.5.1",
"glob": "^7.1.2",
Expand Down
2 changes: 1 addition & 1 deletion qryn_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ let fastify = require('fastify')({

const validate = checkAuth.bind(this)

fastify.register(require('fastify-basic-auth'), {
fastify.register(require('@fastify/basic-auth'), {
validate,
authenticate: true
})
Expand Down

0 comments on commit 8d770ea

Please sign in to comment.