diff --git a/README.md b/README.md index de9c337..b56f916 100644 --- a/README.md +++ b/README.md @@ -290,9 +290,10 @@ and has a set of utilities used internally that can be useful when implementing | | Version | | --- | --- | -| fastify | `>=4.0.0` | +| fastify | `^5.0.0` | | sentry | `^7.0.0` | | Node.js | `>=18` | + ## Powered Apps `fastify-sentry` was created by the amazing Node.js team at [ImmobiliareLabs](https://github.com/immobiliare), the Tech dept of [Immobiliare.it](https://www.immobiliare.it), the #1 real estate company in Italy. diff --git a/index.js b/index.js index 25208e5..f82fbe3 100644 --- a/index.js +++ b/index.js @@ -36,7 +36,7 @@ const fastifySentry = function (fastify, opts, next) { module.exports = fp(fastifySentry, { name: '@immobiliarelabs/fastify-sentry', - fastify: '4.x', + fastify: '5.x', }); module.exports.default = fastifySentry; module.exports.fastifySentry = fastifySentry; diff --git a/package.json b/package.json index d94dd32..ea01551 100644 --- a/package.json +++ b/package.json @@ -63,9 +63,7 @@ }, "devDependencies": { "@arethetypeswrong/cli": "^0.13.4", - "@commitlint/cli": "^18.4.3", - "@commitlint/config-conventional": "^18.4.3", - "@fastify/sensible": "^5.1.0", + "@fastify/sensible": "^6.0.1", "@saithodev/semantic-release-backmerge": "^4.0.1", "@semantic-release/changelog": "^6.0.0", "@semantic-release/commit-analyzer": "^11.0.0", @@ -77,12 +75,11 @@ "@types/node": "^20.1.0", "autocannon": "^7.4.0", "concurrently": "^8.0.1", - "cz-conventional-changelog": "^3.2.0", "eslint": "^8.0.0", "eslint-config-prettier": "^9.0.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^5.0.0", - "fastify": "^4.0.3", + "fastify": "^5.1.0", "husky": "^8.0.0", "is-ci": "^3.0.0", "lint-staged": "^15.2.0", @@ -94,11 +91,6 @@ "tsd": "^0.30.0", "typescript": "^5.0.2" }, - "config": { - "commitizen": { - "path": "./node_modules/cz-conventional-changelog" - } - }, "types": "./index.d.ts", "tsd": { "directory": "test/types" @@ -108,6 +100,6 @@ "@sentry/tracing": "^7.105.0", "@sentry/utils": "^7.105.0", "cookie": "^0.7.0", - "fastify-plugin": "^4.3.0" + "fastify-plugin": "^5.0.1" } } diff --git a/tap-snapshots/test/plugin.test.js.test.cjs b/tap-snapshots/test/plugin.test.js.test.cjs index 3bc3ebf..67c98bd 100644 --- a/tap-snapshots/test/plugin.test.js.test.cjs +++ b/tap-snapshots/test/plugin.test.js.test.cjs @@ -54,7 +54,7 @@ Object { }, "method": "GET", "query_string": Object {}, - "url": "http://localhost:80/oops", + "url": "http://localhost/oops", }, "tags": undefined, "transaction": "GET /oops", @@ -82,7 +82,7 @@ Object { }, "method": "POST", "query_string": Object {}, - "url": "http://localhost:80/body", + "url": "http://localhost/body", }, "tags": undefined, "transaction": "POST /body", @@ -107,7 +107,7 @@ Object { }, "method": "GET", "query_string": Object {}, - "url": "http://localhost:80/oops", + "url": "http://localhost/oops", "user": Object { "email": "some@example.com", "username": "some", @@ -141,7 +141,7 @@ Object { }, "method": "POST", "query_string": Object {}, - "url": "http://localhost:80/body", + "url": "http://localhost/body", "user": Object { "email": "some@example.com", "username": "some", diff --git a/test/fixtures/cjs/package.json b/test/fixtures/cjs/package.json index 9bd27e5..4077ab0 100644 --- a/test/fixtures/cjs/package.json +++ b/test/fixtures/cjs/package.json @@ -11,6 +11,6 @@ "license": "ISC", "dependencies": { "@immobiliarelabs/fastify-sentry": "file:../pack.tgz", - "fastify": "^4.21.0" + "fastify": "^5.1.0" } } diff --git a/test/fixtures/esm/package.json b/test/fixtures/esm/package.json index b1e1f69..a1d1510 100644 --- a/test/fixtures/esm/package.json +++ b/test/fixtures/esm/package.json @@ -11,6 +11,6 @@ "license": "ISC", "dependencies": { "@immobiliarelabs/fastify-sentry": "file:../pack.tgz", - "fastify": "^4.21.0" + "fastify": "^5.1.0" } } diff --git a/test/plugin.test.js b/test/plugin.test.js index 7002e37..a6a8586 100644 --- a/test/plugin.test.js +++ b/test/plugin.test.js @@ -2,7 +2,6 @@ const tap = require('tap'); const { defaultIntegrations } = require('@sentry/node'); -const sensible = require('@fastify/sensible'); const { setup, resetModuleCache, @@ -161,29 +160,6 @@ tap.test('event with transactions enabled', async (t) => { t.matchSnapshot(extractMetaFromEvent(report)); }); -tap.test('@fastify/sensible explicit internal errors support', async (t) => { - const app = await setup( - { dsn: DSN, environment: 'fastify-sentry-test' }, - async (s) => { - s.register(sensible); - }, - async (s) => { - s.get('/sensible', async function () { - throw this.httpErrors.internalServerError('My Error'); - }); - } - ); - const response = await app.inject({ - method: 'GET', - path: '/sensible', - }); - t.equal(500, response.statusCode); - await app.Sentry.flush(); - t.equal(testkit.reports().length, 1); - const payload = JSON.parse(response.payload); - t.equal('My Error', payload.message); -}); - tap.test('custom `shouldHandleError`', async (t) => { const app = await setup({ shouldHandleError: () => false, diff --git a/utils.js b/utils.js index aafc817..33095b6 100644 --- a/utils.js +++ b/utils.js @@ -104,7 +104,7 @@ exports.shouldHandleError = shouldHandleError; const errorResponse = function (error, request, reply) { // @fastify/sensible explicit internal errors support - if (reply.statusCode === 500 && error.explicitInternalServerError !== true) { + if (reply.statusCode === 500) { reply.send(new Error('Something went wrong')); } else { reply.send(error);