f52955ec94
Clean up package.json files in the `examples` directory: - Add `private: true` - Remove `version` (because they are irrelevant for packages that are not meant to be published) - Remove `name` (because they are optional for packages that are not meant to be published, and when someone clones an example, they often rename it and the property becomes stale) - Remove `author` - Remove `description` - Remove `license` Also remove `with-dynamic-app-layout` example completely, since it does the same as `layout-component` (https://github.com/vercel/next.js/pull/27121#discussion_r668178408). ## Documentation / Examples - [x] Make sure the linting passes |
||
---|---|---|
.. | ||
pages | ||
.gitignore | ||
next.config.js | ||
package.json | ||
README.md | ||
sentry.client.config.js | ||
sentry.properties | ||
sentry.server.config.js |
Sentry
This is an example showing how to use Sentry to catch & report errors on both client + server side, using the official Sentry SDK for Next.js.
_app.js
renders on both the server and client_error.js
is rendered by Next.js while handling certain types of exceptions for you. It is overridden so those exceptions can be passed along to Sentry- Each API route is handled with
withSentry
next.config.js
automatically configures the app to use Sentry throughwithSentry
Preview
Preview the example live on StackBlitz:
Deploy your own
Once you have access to your Sentry DSN, deploy the example using Vercel:
Check out Sentry’s Vercel Integration.
How To Use
Execute create-next-app
with npm or Yarn to bootstrap the example:
npx create-next-app --example with-sentry with-sentry-app
# or
yarn create next-app --example with-sentry with-sentry-app
Configuration
You can configure your app automatically or do the manual setup.
Both ways lead to having your custom config files (next.config.js
, sentry.client.config.js
, sentry.server.config.js
, and sentry.properties
); so you can delete them from the example, they are here to illustrate how an example app looks like.
Deploy on Vercel
You can deploy this app to the cloud with Vercel (Documentation).
Deploy Your Local Project
To deploy your local project to Vercel, push it to GitHub/GitLab/Bitbucket and import to Vercel.
Important: When you import your project on Vercel, make sure to click on Environment Variables and set them to match your .env.local
file.
Deploy from Our Template
Alternatively, you can deploy using our template by clicking on the Deploy button below.
Sentry Integration
Sentry’s Vercel Integration connects your Sentry and Vercel projects to automatically upload source maps and notify Sentry of release deployment. Learn more about this integration in Sentry’s full documentation.