Skip to content

Commit 774c3a5

Browse files
committed
remove sentry (might revisit later, idk yet)
1 parent 2b7f3c6 commit 774c3a5

File tree

10 files changed

+115
-2100
lines changed

10 files changed

+115
-2100
lines changed

app/contact/actions.ts

Lines changed: 54 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import { headers } from "next/headers";
44
import * as v from "valibot";
55
import { Resend } from "resend";
6-
import * as Sentry from "@sentry/nextjs";
76
import * as config from "../../lib/config";
87

98
const ContactSchema = v.object({
@@ -47,74 +46,67 @@ export type ContactState = {
4746
};
4847

4948
export const sendMessage = async (prevState: ContactState, formData: FormData): Promise<ContactState> => {
50-
return await Sentry.withServerActionInstrumentation(
51-
"sendMessage",
52-
{
53-
formData,
54-
headers: headers(),
55-
recordResponse: true,
56-
},
57-
async () => {
58-
try {
59-
const data = v.safeParse(ContactSchema, Object.fromEntries(formData));
49+
try {
50+
// TODO: remove after debugging why automated spam entries are causing 500 errors
51+
console.debug("[contact form] received data:", formData);
6052

61-
if (!data.success) {
62-
return {
63-
success: false,
64-
message: "Please make sure all fields are filled in.",
65-
errors: v.flatten(data.issues).nested,
66-
};
67-
}
53+
const data = v.safeParse(ContactSchema, Object.fromEntries(formData));
6854

69-
// validate captcha
70-
const turnstileResponse = await fetch("https://challenges.cloudflare.com/turnstile/v0/siteverify", {
71-
method: "POST",
72-
headers: { "Content-Type": "application/json" },
73-
body: JSON.stringify({
74-
secret: process.env.TURNSTILE_SECRET_KEY || "1x0000000000000000000000000000000AA",
75-
response: data.output["cf-turnstile-response"],
76-
remoteip: (await headers()).get("x-forwarded-for") || "",
77-
}),
78-
cache: "no-store",
79-
signal: AbortSignal.timeout(5000), // 5 second timeout
80-
});
55+
if (!data.success) {
56+
return {
57+
success: false,
58+
message: "Please make sure all fields are filled in.",
59+
errors: v.flatten(data.issues).nested,
60+
};
61+
}
62+
63+
// validate captcha
64+
const turnstileResponse = await fetch("https://challenges.cloudflare.com/turnstile/v0/siteverify", {
65+
method: "POST",
66+
headers: { "Content-Type": "application/json" },
67+
body: JSON.stringify({
68+
secret: process.env.TURNSTILE_SECRET_KEY || "1x0000000000000000000000000000000AA",
69+
response: data.output["cf-turnstile-response"],
70+
remoteip: (await headers()).get("x-forwarded-for") || "",
71+
}),
72+
cache: "no-store",
73+
signal: AbortSignal.timeout(5000), // 5 second timeout
74+
});
8175

82-
if (!turnstileResponse || !turnstileResponse.ok) {
83-
throw new Error(`[contact form] turnstile validation failed: ${turnstileResponse.status}`);
84-
}
76+
if (!turnstileResponse || !turnstileResponse.ok) {
77+
throw new Error(`[contact form] turnstile validation failed: ${turnstileResponse.status}`);
78+
}
8579

86-
const turnstileData = (await turnstileResponse.json()) as { success: boolean };
80+
const turnstileData = (await turnstileResponse.json()) as { success: boolean };
8781

88-
if (!turnstileData.success) {
89-
return {
90-
success: false,
91-
message: "Did you complete the CAPTCHA? (If you're human, that is...)",
92-
};
93-
}
82+
if (!turnstileData.success) {
83+
return {
84+
success: false,
85+
message: "Did you complete the CAPTCHA? (If you're human, that is...)",
86+
};
87+
}
9488

95-
if (!process.env.RESEND_FROM_EMAIL) {
96-
console.warn("[contact form] RESEND_FROM_EMAIL not set, falling back to [email protected].");
97-
}
89+
if (!process.env.RESEND_FROM_EMAIL) {
90+
console.warn("[contact form] RESEND_FROM_EMAIL not set, falling back to [email protected].");
91+
}
9892

99-
// send email
100-
const resend = new Resend(process.env.RESEND_API_KEY);
101-
await resend.emails.send({
102-
from: `${data.output.name} <${process.env.RESEND_FROM_EMAIL ?? "[email protected]"}>`,
103-
replyTo: `${data.output.name} <${data.output.email}>`,
104-
to: [config.authorEmail],
105-
subject: `[${config.siteName}] Contact Form Submission`,
106-
text: data.output.message,
107-
});
93+
// send email
94+
const resend = new Resend(process.env.RESEND_API_KEY);
95+
await resend.emails.send({
96+
from: `${data.output.name} <${process.env.RESEND_FROM_EMAIL ?? "[email protected]"}>`,
97+
replyTo: `${data.output.name} <${data.output.email}>`,
98+
to: [config.authorEmail],
99+
subject: `[${config.siteName}] Contact Form Submission`,
100+
text: data.output.message,
101+
});
108102

109-
return { success: true, message: "Thanks! You should hear from me soon." };
110-
} catch (error) {
111-
Sentry.captureException(error);
103+
return { success: true, message: "Thanks! You should hear from me soon." };
104+
} catch (error) {
105+
console.error("[contact form] fatal error:", error);
112106

113-
return {
114-
success: false,
115-
message: "Internal server error. Please try again later or shoot me an email.",
116-
};
117-
}
118-
}
119-
);
107+
return {
108+
success: false,
109+
message: "Internal server error. Please try again later or shoot me an email.",
110+
};
111+
}
120112
};

app/error.tsx

Lines changed: 0 additions & 14 deletions
This file was deleted.

app/global-error.tsx

Lines changed: 0 additions & 25 deletions
This file was deleted.

app/notes/[slug]/counter.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { connection } from "next/server";
2-
import * as Sentry from "@sentry/nextjs";
32
import commaNumber from "comma-number";
43
import CountUp from "../../../components/CountUp";
54
import redis from "../../../lib/helpers/redis";
@@ -22,7 +21,7 @@ const HitCounter = async ({ slug }: { slug: string }) => {
2221
</span>
2322
);
2423
} catch (error) {
25-
Sentry.captureException(error);
24+
console.error("[hit counter] fatal error:", error);
2625

2726
return <span title="Error getting views! :(">?</span>;
2827
}

instrumentation-client.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

instrumentation.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

next.config.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ const nextConfig: NextConfig = {
4444
serverActions: {
4545
allowedOrigins: ["jarv.is", "jarvis2i2vp4j4tbxjogsnqdemnte5xhzyi7hziiyzxwge3hzmh57zad.onion"],
4646
},
47-
serverSourceMaps: true,
4847
},
4948
eslint: {
5049
dirs: ["app", "components", "contexts", "hooks", "lib", "notes"],
@@ -210,23 +209,6 @@ const nextPlugins: Array<
210209
],
211210
},
212211
}),
213-
[
214-
require("@sentry/nextjs").withSentryConfig,
215-
{
216-
// https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/build/
217-
org: process.env.SENTRY_ORG,
218-
project: process.env.SENTRY_PROJECT,
219-
authToken: process.env.SENTRY_AUTH_TOKEN,
220-
silent: !process.env.CI,
221-
tunnelRoute: "/_stream/otel",
222-
widenClientFileUpload: true,
223-
disableLogger: true,
224-
telemetry: false,
225-
bundleSizeOptimizations: {
226-
excludeDebugStatements: true,
227-
},
228-
},
229-
],
230212
];
231213

232214
// eslint-disable-next-line import/no-anonymous-default-export

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
"@next/mdx": "15.3.0-canary.29",
2828
"@octokit/graphql": "^8.2.1",
2929
"@octokit/graphql-schema": "^15.26.0",
30-
"@sentry/nextjs": "^9.10.1",
3130
"@upstash/redis": "^1.34.6",
3231
"clsx": "^2.1.1",
3332
"comma-number": "^2.1.0",
@@ -75,7 +74,6 @@
7574
"@eslint/eslintrc": "^3.3.1",
7675
"@eslint/js": "^9.23.0",
7776
"@jakejarvis/eslint-config": "^4.0.7",
78-
"@sentry/cli": "^2.43.0",
7977
"@types/comma-number": "^2.1.2",
8078
"@types/mdx": "^2.0.13",
8179
"@types/node": "^22.13.17",
@@ -131,7 +129,6 @@
131129
},
132130
"pnpm": {
133131
"onlyBuiltDependencies": [
134-
"@sentry/cli",
135132
"sharp",
136133
"simple-git-hooks"
137134
],

0 commit comments

Comments
 (0)