Skip to content

Commit 953918d

Browse files
Update and fix Sentry and Algolia Search (#1060)
1 parent add6fea commit 953918d

File tree

10 files changed

+21475
-22502
lines changed

10 files changed

+21475
-22502
lines changed

components/ui/Search.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
type AutocompleteCollection,
2020
} from "@algolia/autocomplete-core";
2121
import { getAlgoliaResults } from "@algolia/autocomplete-preset-algolia";
22-
import algoliasearch from "algoliasearch/lite";
22+
import { liteClient as algoliasearch } from "algoliasearch/lite";
2323
import {
2424
Dialog,
2525
DialogPanel,
@@ -113,8 +113,8 @@ function useAutocomplete({
113113
queries: [
114114
{
115115
indexName: ALGOLIA_SOURCE_IDX,
116-
query,
117116
params: {
117+
query,
118118
hitsPerPage: 6,
119119
},
120120
},

instrumentation.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import * as Sentry from "@sentry/nextjs";
2+
3+
const SENTRY_DSN = process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN;
4+
const SENTRY_ENVIRONMENT = process.env.SENTRY_ENVIRONMENT;
5+
6+
export function register() {
7+
if (process.env.NEXT_RUNTIME === "nodejs") {
8+
// this is your Sentry.init call from `sentry.server.config.js|ts`
9+
Sentry.init({
10+
dsn: SENTRY_DSN,
11+
// Adjust this value in production, or use tracesSampler for greater control
12+
tracesSampleRate: 1,
13+
environment: SENTRY_ENVIRONMENT,
14+
});
15+
}
16+
17+
// This is your Sentry.init call from `sentry.edge.config.js|ts`
18+
if (process.env.NEXT_RUNTIME === "edge") {
19+
Sentry.init({
20+
dsn: SENTRY_DSN,
21+
// Adjust this value in production, or use tracesSampler for greater control
22+
tracesSampleRate: 1,
23+
environment: SENTRY_ENVIRONMENT,
24+
});
25+
}
26+
}

next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/// <reference types="next/image-types/global" />
33

44
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/basic-features/typescript for more information.
5+
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.

next.config.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,18 @@ const config = {
3939
// Temporary to check pipelines due to weird error I can only get on CodePipeline
4040
ignoreBuildErrors: true,
4141
},
42+
experimental: {
43+
instrumentationHook: true,
44+
},
4245
};
4346

4447
// Injected content via Sentry wizard below
4548

4649
const { withSentryConfig } = require("@sentry/nextjs");
4750

48-
module.exports = withSentryConfig(
49-
withMDX(withBundleAnalyzer(config)),
50-
{
51-
silent: true,
52-
org: "codu",
53-
project: "codu",
54-
},
55-
{
56-
hideSourceMaps: true,
57-
},
58-
);
51+
module.exports = withSentryConfig(withMDX(withBundleAnalyzer(config)), {
52+
silent: true,
53+
org: "codu",
54+
project: "codu",
55+
hideSourceMaps: true,
56+
});

0 commit comments

Comments
 (0)