Skip to content

Commit

Permalink
draft breadcrumb and deposit fix (#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernardo Vieira authored Mar 10, 2023
1 parent e460658 commit 349f806
Show file tree
Hide file tree
Showing 15 changed files with 1,470 additions and 85 deletions.
3 changes: 3 additions & 0 deletions example-web/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

# Sentry
.sentryclirc
16 changes: 15 additions & 1 deletion example-web/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
/** @type {import('next').NextConfig} */

const { withSentryConfig } = require('@sentry/nextjs');

const sentryWebpackPluginOptions = {
// Additional config options for the Sentry Webpack plugin. Keep in mind that
// the following options are set automatically, and overriding them is not
// recommended:
// release, url, org, project, authToken, configFile, stripPrefix,
// urlPrefix, include, ignore

silent: false, // Suppresses all logs
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options.
};

const webpack = (config, { webpack }) => {
config.resolve.fallback = {
...config.resolve.fallback,
Expand All @@ -19,4 +33,4 @@ const nextConfig = {
webpack
};

module.exports = nextConfig;
module.exports = withSentryConfig(nextConfig, sentryWebpackPluginOptions);
1 change: 1 addition & 0 deletions example-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@celo/react-celo": "4.2.1",
"@celo/utils": "2.3.0",
"@impact-market/utils": "link:..",
"@sentry/nextjs": "^7.36.0",
"@walletconnect/client": "1.8.0",
"ethers": "5.7.2",
"next": "12.3.1",
Expand Down
39 changes: 39 additions & 0 deletions example-web/pages/_error.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* NOTE: This requires `@sentry/nextjs` version 7.3.0 or higher.
*
* NOTE: If using this with `next` version 12.2.0 or lower, uncomment the
* penultimate line in `CustomErrorComponent`.
*
* This page is loaded by Nextjs:
* - on the server, when data-fetching methods throw or reject
* - on the client, when `getInitialProps` throws or rejects
* - on the client, when a React lifecycle method throws or rejects, and it's
* caught by the built-in Nextjs error boundary
*
* See:
* - https://nextjs.org/docs/basic-features/data-fetching/overview
* - https://nextjs.org/docs/api-reference/data-fetching/get-initial-props
* - https://reactjs.org/docs/error-boundaries.html
*/

import * as Sentry from '@sentry/nextjs';
import NextErrorComponent from 'next/error';

const CustomErrorComponent = props => {
// If you're using a Nextjs version prior to 12.2.1, uncomment this to
// compensate for https://github.com/vercel/next.js/issues/8592
// Sentry.captureUnderscoreErrorException(props);

return <NextErrorComponent statusCode={props.statusCode} />;
};

CustomErrorComponent.getInitialProps = async contextData => {
// In case this is running in a serverless function, await this in order to give Sentry
// time to send the error before the lambda exits
await Sentry.captureUnderscoreErrorException(contextData);

// This will contain the status code of the response
return NextErrorComponent.getInitialProps(contextData);
};

export default CustomErrorComponent;
19 changes: 19 additions & 0 deletions example-web/sentry.client.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// This file configures the initialization of Sentry on the browser.
// The config you add here will be used whenever a page is visited.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/

import * as Sentry from '@sentry/nextjs';

const SENTRY_DSN = process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN;

Sentry.init({
dsn: SENTRY_DSN || 'https://b0203ca1cbd548c493cae5dd009f66be@o442089.ingest.sentry.io/6171011',
// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1.0,
debug: true,
environment: 'development'
// ...
// Note: if you want to override the automatic release value, do not set a
// `release` value here - use the environment variable `SENTRY_RELEASE`, so
// that it will also get attached to your source maps
});
4 changes: 4 additions & 0 deletions example-web/sentry.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
defaults.url=https://sentry.io/
defaults.org=impactmarket
defaults.project=pwa
cli.executable=../node_modules/@sentry/cli/bin/sentry-cli
17 changes: 17 additions & 0 deletions example-web/sentry.server.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// This file configures the initialization of Sentry on the server.
// The config you add here will be used whenever the server handles a request.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/

import * as Sentry from '@sentry/nextjs';

const SENTRY_DSN = process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN;

Sentry.init({
dsn: SENTRY_DSN || 'https://b0203ca1cbd548c493cae5dd009f66be@o442089.ingest.sentry.io/6171011',
// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1.0,
// ...
// Note: if you want to override the automatic release value, do not set a
// `release` value here - use the environment variable `SENTRY_RELEASE`, so
// that it will also get attached to your source maps
});
2 changes: 1 addition & 1 deletion example-web/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es5",
"target": "es6",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
Expand Down
Loading

0 comments on commit 349f806

Please sign in to comment.