Skip to content

Commit

Permalink
sentry & fixes 4
Browse files Browse the repository at this point in the history
  • Loading branch information
c0repwn3r committed Nov 9, 2024
1 parent 4fd4bfb commit f11bdc4
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 19 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
SMTP_AUTH_USER: ${{ secrets.SMTP_AUTH_USER }}
SMTP_AUTH_PASS: ${{ secrets.SMTP_AUTH_PASS }}
SMTP_EMAIL_FROM: ${{ secrets.SMTP_EMAIL_FROM }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
PUBLIC_SENTRY_DSN: ${{ secrets.PUBLIC_SENTRY_DSN }}
steps:
- name: Checkout source
uses: actions/checkout@v4
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ Thumbs.db
# Vite
vite.config.js.timestamp-*
vite.config.ts.timestamp-*

# Sentry Config File
.env.sentry-build-plugin
Binary file modified bun.lockb
Binary file not shown.
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@
"zod": "^3.23.8"
},
"dependencies": {
"mysql2": "^3.11.4",
"drizzle-orm": "^0.35.3",
"drizzle-kit": "^0.26.2",
"nodemailer": "^6.9.16",
"@sentry/sveltekit": "^8.37.1",
"clsx": "^2.1.1",
"drizzle-kit": "^0.26.2",
"drizzle-orm": "^0.35.3",
"luxon": "^3.5.0",
"mysql2": "^3.11.4",
"nanoid": "^5.0.8",
"tailwind-merge": "^2.5.4",
"sveltekit-superforms": "^2.20.0"
"nodemailer": "^6.9.16",
"sveltekit-superforms": "^2.20.0",
"tailwind-merge": "^2.5.4"
}
}
23 changes: 23 additions & 0 deletions src/hooks.client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { handleErrorWithSentry, replayIntegration } from "@sentry/sveltekit";
import * as Sentry from '@sentry/sveltekit';
import { PUBLIC_SENTRY_DSN } from "$env/static/public";

Sentry.init({
dsn: PUBLIC_SENTRY_DSN,

tracesSampleRate: 1.0,

// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 1.0,

// If the entire session is not sampled, use the below sample rate to sample
// sessions when an error occurs.
replaysOnErrorSampleRate: 1.0,

// If you don't want to use Session Replay, just remove the line below:
integrations: [replayIntegration()],
});

// If you have a custom error handler, pass it to `handleErrorWithSentry`
export const handleError = handleErrorWithSentry();
19 changes: 19 additions & 0 deletions src/hooks.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { sequence } from "@sveltejs/kit/hooks";
import { handleErrorWithSentry, sentryHandle } from "@sentry/sveltekit";
import * as Sentry from '@sentry/sveltekit';
import { PUBLIC_SENTRY_DSN } from "$env/static/public";

Sentry.init({
dsn: PUBLIC_SENTRY_DSN,

tracesSampleRate: 1.0,

// uncomment the line below to enable Spotlight (https://spotlightjs.com)
// spotlight: import.meta.env.DEV,
});

// If you have custom handlers, make sure to place them after `sentryHandle()` in the `sequence` function.
export const handle = sequence(sentryHandle());

// If you have a custom error handler, pass it to `handleErrorWithSentry`
export const handleError = handleErrorWithSentry();
13 changes: 2 additions & 11 deletions src/routes/(authed)/schedule/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,24 +88,15 @@ function slottificate(
second: 0,
millisecond: 0
});
console.log(start, todaysAvail);
const end = dayInMentorsTz.set({
hour: todaysAvail.end.hour,
minute: todaysAvail.end.minute,
second: 0,
millisecond: 0
});
console.log(end, todaysAvail);

const interval = Interval.fromDateTimes(start, end);

console.log(interval);
if (interval.start == null) {
console.log("-- INVALID INTERVAL --");
console.log(start);
console.log(end);
}

availablePeriodsMentorsTime.push(interval);
}
}
Expand All @@ -119,7 +110,7 @@ function slottificate(
for (const period of availablePeriodsMentorsTime) {
if (!period.start || !period.end) {
console.log(period);
return;
continue; // invalid... ignore
}
availablePeriods.push(
Interval.fromDateTimes(period.start.setZone('utc'), period.end.setZone('utc'))
Expand All @@ -128,7 +119,7 @@ function slottificate(
for (const period of unavailablePeriodsMentorsTime) {
if (!period.start || !period.end) {
console.log(period);
return;
continue; // invalid... ignore
}
unavailablePeriods.push(
Interval.fromDateTimes(period.start.setZone('utc'), period.end.setZone('utc'))
Expand Down
10 changes: 8 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { sentrySvelteKit } from "@sentry/sveltekit";
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';

export default defineConfig({
plugins: [sveltekit()]
});
plugins: [sentrySvelteKit({
sourceMapsUploadOptions: {
org: "ztl-scheddy",
project: "javascript-sveltekit"
}
}), sveltekit()]
});

0 comments on commit f11bdc4

Please sign in to comment.