diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 8b01c5d..3d7455f 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,6 @@ +[1.0.4] +- sentry connection + [1.0.3] - simpler js - no biome diff --git a/index.mjs b/index.mjs index 9e4626b..b3b5eb8 100644 --- a/index.mjs +++ b/index.mjs @@ -12,6 +12,14 @@ const server = Server.configure({ port, onConnect({ connection }) { connection.requiresAuthentication = true; +const Sentry = require("@sentry/node"); +Sentry.init({ dsn: process.env.SENTRY_DSN }); + +const startServer = async () => { + const server = await Server.configure({ + port: process.env.PORT || 4000, + async onConnect({ connection }) { + connection.requiresAuthentication = true; }, onAuthenticate(data) { return new Promise((resolve, reject) => { @@ -116,4 +124,12 @@ const server = Server.configure({ }, }); -server.listen().then(r => console.info('Server started')); +process.on('unhandledRejection', (reason, promise) => { + Sentry.captureException(reason); +}); + +process.on('uncaughtException', (error) => { + Sentry.captureException(error); +}); + +startServer(); diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 3f48024..0000000 --- a/package-lock.json +++ /dev/null @@ -1,212 +0,0 @@ -{ - "name": "discours-editing-server", - "version": "1.0.3", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "discours-editing-server", - "version": "1.0.3", - "license": "MIT", - "dependencies": { - "@authorizerdev/authorizer-js": "^2.0.0", - "@hocuspocus/server": "^2.11.2" - } - }, - "node_modules/@authorizerdev/authorizer-js": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@authorizerdev/authorizer-js/-/authorizer-js-2.0.0.tgz", - "integrity": "sha512-PTVuCrCkZkVPoo+l0+9PVFyP9frLp/L3FUtQDtAaN+ERuqx97DNF20tIH8khSvnXrkKv3lTJ/5iFWddy+dTAwg==", - "dependencies": { - "cross-fetch": "^3.1.5" - }, - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/authorizerdev" - } - }, - "node_modules/@hocuspocus/common": { - "version": "2.11.3", - "resolved": "https://registry.npmjs.org/@hocuspocus/common/-/common-2.11.3.tgz", - "integrity": "sha512-w3UZpW6ZVYIHPEFzZJV3yn1d3EZaXf2m2zU53pwj0AyTBmVD7kB9ZiD6twc9A7NNB1dkqD8c58PbD42+pnNiKQ==", - "dependencies": { - "lib0": "^0.2.87" - } - }, - "node_modules/@hocuspocus/server": { - "version": "2.11.3", - "resolved": "https://registry.npmjs.org/@hocuspocus/server/-/server-2.11.3.tgz", - "integrity": "sha512-1Vdy4RtJcpffs5I4Ey3M8ulu2f6AbpSDmK4YFG8k3O4EJT7HDSO3Ib5STiRBxlr2LncJeVa2ikwlvwQotsWqew==", - "dependencies": { - "@hocuspocus/common": "^2.11.3", - "async-lock": "^1.3.1", - "kleur": "^4.1.4", - "lib0": "^0.2.47", - "uuid": "^9.0.0", - "ws": "^8.5.0" - }, - "peerDependencies": { - "y-protocols": "^1.0.6", - "yjs": "^13.6.8" - } - }, - "node_modules/async-lock": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/async-lock/-/async-lock-1.4.1.tgz", - "integrity": "sha512-Az2ZTpuytrtqENulXwO3GGv1Bztugx6TT37NIo7imr/Qo0gsYiGtSdBa2B6fsXhTpVZDNfu1Qn3pk531e3q+nQ==" - }, - "node_modules/cross-fetch": { - "version": "3.1.8", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz", - "integrity": "sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==", - "dependencies": { - "node-fetch": "^2.6.12" - } - }, - "node_modules/isomorphic.js": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/isomorphic.js/-/isomorphic.js-0.2.5.tgz", - "integrity": "sha512-PIeMbHqMt4DnUP3MA/Flc0HElYjMXArsw1qwJZcm9sqR8mq3l8NYizFMty0pWwE/tzIGH3EKK5+jes5mAr85yw==", - "funding": { - "type": "GitHub Sponsors ❤", - "url": "https://github.com/sponsors/dmonad" - } - }, - "node_modules/kleur": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", - "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", - "engines": { - "node": ">=6" - } - }, - "node_modules/lib0": { - "version": "0.2.90", - "resolved": "https://registry.npmjs.org/lib0/-/lib0-0.2.90.tgz", - "integrity": "sha512-iQmk+fThPq1ZTD2cFUu8xN6JLp9gFWnjs8auR6hmI6QQXoy6sSEh85uKcdkqpuEnkhhwQm4GSlKHOYfSCVp0Mw==", - "dependencies": { - "isomorphic.js": "^0.2.4" - }, - "bin": { - "0gentesthtml": "bin/gentesthtml.js", - "0serve": "bin/0serve.js" - }, - "engines": { - "node": ">=16" - }, - "funding": { - "type": "GitHub Sponsors ❤", - "url": "https://github.com/sponsors/dmonad" - } - }, - "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" - }, - "node_modules/uuid": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", - "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", - "funding": [ - "https://github.com/sponsors/broofa", - "https://github.com/sponsors/ctavan" - ], - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" - }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, - "node_modules/ws": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", - "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/y-protocols": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/y-protocols/-/y-protocols-1.0.6.tgz", - "integrity": "sha512-vHRF2L6iT3rwj1jub/K5tYcTT/mEYDUppgNPXwp8fmLpui9f7Yeq3OEtTLVF012j39QnV+KEQpNqoN7CWU7Y9Q==", - "peer": true, - "dependencies": { - "lib0": "^0.2.85" - }, - "engines": { - "node": ">=16.0.0", - "npm": ">=8.0.0" - }, - "funding": { - "type": "GitHub Sponsors ❤", - "url": "https://github.com/sponsors/dmonad" - }, - "peerDependencies": { - "yjs": "^13.0.0" - } - }, - "node_modules/yjs": { - "version": "13.6.14", - "resolved": "https://registry.npmjs.org/yjs/-/yjs-13.6.14.tgz", - "integrity": "sha512-D+7KcUr0j+vBCUSKXXEWfA+bG4UQBviAwP3gYBhkstkgwy5+8diOPMx0iqLIOxNo/HxaREUimZRxqHGAHCL2BQ==", - "peer": true, - "dependencies": { - "lib0": "^0.2.86" - }, - "engines": { - "node": ">=16.0.0", - "npm": ">=8.0.0" - }, - "funding": { - "type": "GitHub Sponsors ❤", - "url": "https://github.com/sponsors/dmonad" - } - } - } -} diff --git a/package.json b/package.json index 4896218..653f0a8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "discours-editing-server", - "version": "1.0.3", + "version": "1.0.4", "description": "discours.io webrtc p2p network helping crdt-server", "main": "index.mjs", "type": "module", @@ -15,6 +15,7 @@ "license": "MIT", "dependencies": { "@authorizerdev/authorizer-js": "^2.0.0", - "@hocuspocus/server": "^2.11.2" + "@hocuspocus/server": "^2.11.2", + "@sentry/node": "^6.14.0" } }