Sentry integration for Peakfijn Next projects
Last updated a year ago by bycedric .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @peakfijn/next-sentry 
SYNC missed versions from official npm registry.

Next Sentry - Peakfijn

Quickly integrate Sentry in Next using environment variables and a React boundary.

npm install --save @peakfijn/next-sentry
  1. Getting started
  2. Used variables

Getting started

To set up Sentry, we need to initialize the client. You can do that with this code.

import { config } from '@peakfijn/next-sentry';
// initialize sentry with variables from environment
// initialize sentry with extra config
	dns: '<DSN>',
	maxBreadcrumbs: 50,
	debug: true,
// or initialize sentry instantly with environment variables
import '@peakfijn/next-sentry/config';

After Sentry is set up, we need to "catch" React errors. You can do this by wrapping all components in src/pages/_app.tsx with the SentryBoundary component.

We recommend wrapping all components with this boundary, but you can also use this for individual components.

import React from 'react';
import NextApp from 'next/app';
import { SentryBoundary } from '@peakfijn/next-sentry';

export default class App extends NextApp {
	render() {
		const { Component, pageProps } = this.props;

		return (
				<Component {...pageProps} />

Used variables

This library can enable Sentry automatically if you use the provided environment variables.

variable required? description
SENTRY_DSN required Your project DSN to authenticate the Sentry client.
SENTRY_RELEASE optional An unique release or version name.
SENTRY_ENVIRONMENT optional The environment name of the project.
SENTRY_SILENT optional Hide the warning and skip Sentry init, if no DSN is set.


The MIT License (MIT). Please see License File for more information.


Current Tags

  • 0.0.0                                ...           latest (a year ago)

1 Versions

  • 0.0.0                                ...           a year ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (1)
Dev Dependencies (6)
Dependents (0)

Copyright 2014 - 2016 © taobao.org |