Skip to content
This repository has been archived by the owner on Nov 11, 2021. It is now read-only.

Commit

Permalink
Added additional logging for empty lobby id bug in backend
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasK33 committed Nov 22, 2020
1 parent 4359630 commit 7764666
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 15 deletions.
5 changes: 5 additions & 0 deletions devops/kubernetes/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ export class Fortify extends Chart {
},
{ name: "SENTRY_DSN", value: BACKEND_SENTRY_DSN },
{ name: "SENTRY_TRACE_SAMPLE_RATE", value: "0.2" },
{
name: "IGNORE_ERROR_CODES",
value:
"NOT_AUTHENTICATED;QUERY_PROFILE_NOT_ALLOWED;QUERY_LOBBY_FPS_LOBBY_ID;QUERY_LOBBY_FPS_NOT_FOUND",
},
],
secrets: [vaultSecret],
configmaps: [
Expand Down
10 changes: 8 additions & 2 deletions devops/kubernetes/src/deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ export class FortifyDeployment extends Construct {
periodSeconds: 10,
};
}
if (livenessProbe === null) {
livenessProbe = undefined;
}
if (readinessProbe === null) {
readinessProbe = undefined;
}

const selectorLabels = {
app: Node.of(this).uniqueId,
Expand Down Expand Up @@ -155,8 +161,8 @@ export class FortifyDeployment extends Construct {
})),
],
env,
livenessProbe: livenessProbe || undefined,
readinessProbe: readinessProbe || undefined,
livenessProbe,
readinessProbe,
},
],
},
Expand Down
8 changes: 4 additions & 4 deletions services/backend/package-lock.json

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

4 changes: 2 additions & 2 deletions services/backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "backend",
"version": "1.5.1",
"version": "1.5.2",
"private": true,
"main": "build/index.js",
"types": "build/index.d.ts",
Expand Down Expand Up @@ -61,7 +61,7 @@
"chai-as-promised": "^7.1.1",
"cpx": "^1.5.0",
"debug": "^4.3.1",
"eslint": "^7.13.0",
"eslint": "^7.14.0",
"eslint-config-google": "^0.14.0",
"gts": "^3.0.2",
"nodemon": "^2.0.6",
Expand Down
32 changes: 30 additions & 2 deletions services/backend/src/graphql/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import { schema } from "./schemaLoader";
import * as Sentry from "@sentry/node";
import { Transaction } from "@sentry/types";
import { Context } from "@shared/definitions/context";
import { GraphQLError } from "graphql";

const { IGNORE_ERROR_CODES } = process.env;

const ignorableErrorCodes = IGNORE_ERROR_CODES?.split(";");

@injectable()
export class GraphQL {
Expand Down Expand Up @@ -66,9 +71,16 @@ export class GraphQL {
for (const err of ctx.errors) {
// Only report internal server errors,
// all errors extending ApolloError should be user-facing
if (err instanceof ApolloError) {
continue;
}

if (
err instanceof ApolloError
// || err instanceof GraphQLError
err instanceof GraphQLError &&
err.extensions &&
ignorableErrorCodes?.includes(
err.extensions.code,
)
) {
continue;
}
Expand Down Expand Up @@ -122,6 +134,22 @@ export class GraphQL {
);
}

if (
err instanceof GraphQLError &&
err.extensions &&
err.extensions.code ===
"QUERY_LOBBY_ID"
) {
scope.setExtra(
"extensions",
JSON.stringify(
err.extensions,
null,
2,
),
);
}

Sentry.captureException(err);
});
}
Expand Down
4 changes: 4 additions & 0 deletions services/backend/src/graphql/modules/lobby.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ export class LobbyModule implements GQLModule {
throw new ApolloError(
"No Lobby ID passed",
"QUERY_LOBBY_ID",
{
context,
args,
},
);
}

Expand Down
2 changes: 1 addition & 1 deletion services/jobs/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 services/jobs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jobs",
"version": "1.3.2",
"version": "1.3.3",
"description": "Job scripts and one off scripts",
"author": {
"name": "Thomas Kosiewski"
Expand Down
2 changes: 2 additions & 0 deletions services/shared/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"cSpell.words": [
"Deserialization",
"HISTORIZATION",
"Rebalance",
"Streetfight",
"bignumber",
"godaddy",
Expand All @@ -13,6 +14,7 @@
"kmmrbot",
"leaderboard",
"postgres",
"rebalancing",
"steamid",
"typeorm"
]
Expand Down
2 changes: 1 addition & 1 deletion services/shared/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 services/shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "shared",
"version": "1.8.2",
"version": "1.8.3",
"description": "Shared library for fortify micro services",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion services/shared/src/connectors/postgres.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class PostgresConnector implements HealthCheckable {
this.healthCheck = async () => {
const conn = await this.connection;

return conn.isConnected && conn.query("SELECT now();");
return conn.isConnected && (await conn.query("SELECT now();"));
};
this.shutdown = async () =>
(await this.connection).isConnected &&
Expand Down

0 comments on commit 7764666

Please sign in to comment.