summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-09-23 12:10:36 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-09-23 12:10:36 +1000
commit9bafc5688e9b4218837fa434ecfcc8dae5d82eb8 (patch)
tree14ef2f78b5a2dcf9cb0d05398490031465d1aa1c
parentSentry gateway tracking (diff)
downloadserver-9bafc5688e9b4218837fa434ecfcc8dae5d82eb8.tar.xz
Add mysql sentry integration
-rw-r--r--bundle/src/Server.ts1
-rw-r--r--gateway/src/events/Message.ts4
-rw-r--r--gateway/src/opcodes/Identify.ts4
3 files changed, 5 insertions, 4 deletions
diff --git a/bundle/src/Server.ts b/bundle/src/Server.ts
index 57e8c63a..da810d9b 100644
--- a/bundle/src/Server.ts
+++ b/bundle/src/Server.ts
@@ -73,6 +73,7 @@ async function main() {
 			integrations: [
 				new Sentry.Integrations.Http({ tracing: true }),
 				new Tracing.Integrations.Express({ app }),
+				new Tracing.Integrations.Mysql(),
 			],
 			tracesSampleRate: Config.get().sentry.traceSampleRate,
 			environment: Config.get().sentry.environment,
diff --git a/gateway/src/events/Message.ts b/gateway/src/events/Message.ts
index 0b1a8b2c..b72ffa37 100644
--- a/gateway/src/events/Message.ts
+++ b/gateway/src/events/Message.ts
@@ -9,7 +9,7 @@ import { Tuple } from "lambert-server";
 import { check } from "../opcodes/instanceOf";
 import WS from "ws";
 import BigIntJson from "json-bigint";
-import Sentry from "@Sentry/node";
+import * as Sentry from "@sentry/node";
 const bigIntJson = BigIntJson({ storeAsString: true });
 
 const PayloadSchema = {
@@ -56,7 +56,7 @@ export async function Message(this: WebSocket, buffer: WS.Data) {
 		name: `GATEWAY ${OPCODES[data.op]}`,
 		data: {
 			...data.d,
-			token: data.d.token ? "[Redacted]" : undefined,
+			token: data?.d?.token ? "[Redacted]" : undefined,
 		},
 	});
 
diff --git a/gateway/src/opcodes/Identify.ts b/gateway/src/opcodes/Identify.ts
index bd36e052..d85f86a5 100644
--- a/gateway/src/opcodes/Identify.ts
+++ b/gateway/src/opcodes/Identify.ts
@@ -35,7 +35,7 @@ import { Recipient } from "@fosscord/util";
 
 export async function onIdentify(this: WebSocket, data: Payload) {
 	clearTimeout(this.readyTimeout);
-	if (typeof data.d?.client_state?.highest_last_message_id === "number") 
+	if (typeof data.d?.client_state?.highest_last_message_id === "number")
 		data.d.client_state.highest_last_message_id += "";
 	check.call(this, IdentifySchema, data.d);
 
@@ -297,5 +297,5 @@ export async function onIdentify(this: WebSocket, data: Payload) {
 
 	await setupListener.call(this);
 
-	console.log(`${this.ipAddress} identified as ${d.user.id}`)
+	console.log(`${this.ipAddress} identified as ${d.user.id}`);
 }