Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
224 changes: 224 additions & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
},
"dependencies": {
"@apollo/client": "^3.7.4",
"@bugsnag/js": "^7.20.2",
"@bugsnag/plugin-react": "^7.19.0",
"@holaplex/ui-library-react": "^0.19.0",
"@ory/client": "^1.1.41",
"@ory/integrations": "^1.1.0",
Expand Down
2 changes: 2 additions & 0 deletions src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import { OryProvider } from '../providers/OryProvider';
import { apollo } from '../client';
import { ToastContainer } from 'react-toastify';
import { Session } from '@ory/client';
import { start } from '../modules/bugsnag';

start();
interface AppLayoutProps {
children: React.ReactNode;
session?: Session;
Expand Down
2 changes: 2 additions & 0 deletions src/app/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import Image from 'next/image';
import { Icon } from '../components/Icon';
import { Button } from '@holaplex/ui-library-react';
import Typography from '../components/Typography';
import Bugsnag from '@bugsnag/js';

export default function AppError({ error, reset }: { error: Error; reset: () => void }) {
Bugsnag.notify(error, (event) => {});
return (
<main className="w-full flex justify-center align-middle flex-col h-screen">
<Card className="flex flex-col gap-6 w-96 mx-auto justify-center items-center text-center">
Expand Down
29 changes: 29 additions & 0 deletions src/modules/bugsnag.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import Bugsnag from '@bugsnag/js';

export function start() {
// next.js executes top-level code at build time. See https://github.com/vercel/next.js/discussions/16840 for further example
// So use NEXT_PHASE to avoid Bugsnag.start being executed during the build phase
// See https://nextjs.org/docs/api-reference/next.config.js/introduction and https://github.com/vercel/next.js/blob/canary/packages/next/shared/lib/constants.ts#L1-L5 for
// more details on NEXT_PHASE
if (process.env.NEXT_PHASE !== 'phase-production-build') {
if (process.env.NEXT_IS_SERVER) {
// Bugsnag.start({
// apiKey: process.env.NEXT_PUBLIC_BUGSNAG_API_KEY as string,
// appVersion: process.env.NEXT_BUILD_ID,
// // @bugsnag/plugin-aws-lambda must only be imported on the server
// plugins: [require('@bugsnag/plugin-aws-lambda')],
// });
} else {
// If preferred two separate Bugsnag projects e.g. a javascript and a node project could be used rather than a single one
Bugsnag.start({
apiKey: process.env.NEXT_PUBLIC_BUGSNAG_API_KEY as string,
appVersion: process.env.NEXT_BUILD_ID,
plugins: [],
});
}
}
}

// export function getServerlessHandler() {
// return Bugsnag.getPlugin('awsLambda').createHandler();
// }