Skip to content

Commit

Permalink
feat!: Upgrade to Fastify 5 and Node 20 (#367)
Browse files Browse the repository at this point in the history
  • Loading branch information
markrzen authored Oct 11, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent e323b8b commit f28bec1
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ jobs:
AUTH0_API_AUDIENCE: ${{ secrets.AUTH0_API_AUDIENCE }}
strategy:
matrix:
node: [16, 18, 20]
node: [20, 22]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ function fastifyAuth0Verify(instance, options, done) {
}
}

module.exports = fastifyPlugin(fastifyAuth0Verify, { name: 'fastify-auth0-verify', fastify: '4.x' })
module.exports = fastifyPlugin(fastifyAuth0Verify, { name: 'fastify-auth0-verify', fastify: '5.x' })

// Set the default export to the fastifyAuth0Verify function for ES module compatibility
module.exports.default = fastifyAuth0Verify
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -46,10 +46,10 @@
"postpublish": "git push origin && git push origin -f --tags"
},
"dependencies": {
"@fastify/cookie": "^9.0.4",
"@fastify/jwt": "^8.0.0",
"fastify-jwt-jwks": "^1.1.3",
"fastify-plugin": "^4.0.0"
"@fastify/cookie": "^11.0.1",
"@fastify/jwt": "^9.0.1",
"fastify-jwt-jwks": "^2.0.0",
"fastify-plugin": "^5.0.1"
},
"devDependencies": {
"cross-fetch": "^4.0.0",
@@ -63,14 +63,14 @@
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-promise": "^6.0.1",
"fast-jwt": "^4.0.0",
"fastify": "^4.0.2",
"fastify": "^5.0.0",
"jest": "^29.0.0",
"nock": "^13.0.2",
"prettier": "^3.0.1",
"tsd": "^0.31.0",
"typescript": "^5.0.2"
},
"engines": {
"node": ">= 16"
"node": ">= 20"
}
}
12 changes: 6 additions & 6 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -295,12 +295,12 @@ describe('JWT token decoding', function () {
it('should complain if the HTTP Authorization header is in the wrong format', async function () {
const response = await server.inject({ method: 'GET', url: '/decode', headers: { Authorization: 'FOO' } })

expect(response.statusCode).toEqual(400)
expect(response.statusCode).toEqual(401)
expect(response.json()).toEqual({
code: 'FST_JWT_BAD_REQUEST',
statusCode: 400,
error: 'Bad Request',
message: 'Format is Authorization: Bearer [token]'
code: 'FST_JWT_NO_AUTHORIZATION_IN_HEADER',
statusCode: 401,
error: 'Unauthorized',
message: 'No Authorization was found in request.headers'
})
})
})
@@ -920,7 +920,7 @@ describe('General error handling', function () {
expect(response.json()).toEqual({
statusCode: 401,
error: 'Unauthorized',
message: 'Authorization header should be in format: Bearer [token].'
message: 'Missing Authorization HTTP header.'
})
})

0 comments on commit f28bec1

Please sign in to comment.