Commit graph

26 commits

Author SHA1 Message Date
Tim Neutkens
ab42da0626
Run next/link codemod for Next.js 13 on examples (#41913) 2022-10-30 21:00:45 +01:00
Luca Forstner
93bdaf1078
Remove references to withSentry function in with-sentry example (#41326)
<!--
Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change that you're making:
-->

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [x] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)

## Content

In version
[`7.15.0`](https://github.com/getsentry/sentry-javascript/releases/tag/7.15.0)
of the `@sentry/nextjs` SDK we introduced a new build-time feature that
removes the need for manually wrapping API routes.

This PR removes all manual `withSentry` calls from the `with-sentry`
example.

Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-10-11 16:16:16 +02:00
Katie Byers
4a774a4864
feat(examples): Use helper function in with-sentry example _error.js (#37866)
This updates the `with-sentry` example to use the new helper function `captureUnderscoreErrorException` in its `_error.js` page. This new function both adds more data to sentry events and allows the code to be cleaned up quite a bit.

Fixes https://github.com/vercel/next.js/issues/37870.

- [x] Make sure the linting passes by running `pnpm lint`
- [x] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-07-15 21:02:13 +00:00
JJ Kasper
167a91b73e
Remove un-helpful error in with-sentry example (#36902)
The error reported here is unclear and un-helpful so we shouldn't be recommending to report this by default. 

x-ref: [slack thread](https://vercel.slack.com/archives/CGU8HUTUH/p1652466540356879) 

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-05-13 23:15:09 +00:00
Katie Byers
c03fa72c99
Add tracing to with-sentry example for Next.js 11 (#30401) 2021-11-29 17:02:00 -06:00
Katie Byers
cee1565688
fix(with-sentry example): Small tweaks (#28359)
This PR makes two changes:

- It updates the index page to reflect the fact that `withSentry` should now be working for API routes deployed to Vercel.
- It changes the route which returns a promise rejection to be more obvious about the fact that that's what it's doing.
2021-09-17 14:14:52 +00:00
iker barriocanal
4bc87e479c
Update example with-sentry (#24819)
The [official Sentry Next.js SDK](https://docs.sentry.io/platforms/javascript/guides/nextjs/) is now the recommended choice to use with Next.js, instead of the previous workarounds. This PR updates the example, which now uses the SDK.
2021-05-07 12:52:03 +00:00
Lee Robinson
5a73859fe8
Update docs and Create Next App to use API Middlewares by default. (#21639) 2021-01-28 23:34:03 +00:00
Weston Thayer
6aef4b8445
Update with-sentry example to show how to track API routes + bug fixes (#16484)
## New features

- Example of how to use `Sentry.captureException()` in API routes 5a35982717

## Bug fixes

- Server-side source maps now work in Sentry when deployed to Vercel 629a9ed504
- If uploading source maps, `Sentry.init()` now sets the `release`, so that exceptions are correctly associated with the source maps in that release

## Open issues

### `_error.js` is unused for `getServerSideProps` errors when deployed to Vercel

Instead of rendering this example's overridden `_error.js` (like it does when testing locally with `NODE_ENV='production'`), when deployed to Vercel and an Error is thrown from `getServerSideProps`, this page is shown:

![Screenshot of Vercel Application Error page](https://user-images.githubusercontent.com/709153/90968889-aa3c3d00-e4a6-11ea-9eff-fafee3d1ff33.png)

This confuses me because the Error is still successfully sent to Sentry, but I would've expected it to be sent by the call to `Sentry.captureException()` in `_error.js`. I'm not sure why it works.

### API test 2 & 3 don't work in the "server" build config

They don't work when deployed to Vercel in the "serverless" config either, but that's expected because there aren't any handlers to flush the Sentry queue. I can't figure out why they don't work in the long-lived "server" config.
2020-11-09 18:36:36 +00:00
Kazuhito Hokamura
7a9ee4b9e5
Update Sentry example to improve display of server errors (#15495)
In the Sentry example, sourcemaps is not enabled in server error.

I solved this problem by using `RewriteFrames`. On the client side, the sourcemaps path is `~/_next`, but on the server side it needs to be `~/.next` (distDir), so I rewrite it using the `iteratee`.

ref. https://docs.sentry.io/platforms/node/sourcemaps/#updating-sentry-sdk-configuration-to-support-source-maps

-----

## before
<img width="983" alt="ss2" src="https://user-images.githubusercontent.com/39471/88479997-29188580-cf8e-11ea-8d16-10ccfa6fc1a4.png">

## after
<img width="989" alt="ss1" src="https://user-images.githubusercontent.com/39471/88479995-26b62b80-cf8e-11ea-8b1f-7784b32b9e6d.png">
2020-08-07 07:22:08 +00:00
Luis Alvarez D
73303a71ae
[Examples] Fix with-sentry (#15694) 2020-07-30 11:59:27 -04:00
Stephen Cefali
59924967f1
remove broken server example (#15653)
This removes the server 4 example which breaks all server code since the error will happen when the file is sourced.
2020-07-29 23:58:11 +00:00
Colleen O'Rourke
23ebe3e4aa
Update Sentry example for use with Sentry/Vercel integration (#15349)
* Update Sentry example for use with Sentry/Vercel integration

* update linting

* Update link in readme

* Update readme, add comment

* Add step about commit SHA

* Updated readme

* Use if

* dont call sentry webpack plugin w/o a commit sha present

* Update examples/with-sentry/README.md

Co-authored-by: Luis Alvarez D. <luis@vercel.com>

* update release value

* prettier readme

* Updated note

Co-authored-by: Luis Alvarez <luis@vercel.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-07-23 16:32:44 -05:00
Todor Totev
47e2beba20
[Example] Deprecate with-sentry in favor of with-sentry-simple (#13904)
Co-authored-by: Luis Alvarez D <luis@vercel.com>
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-06-08 21:32:23 -04:00
TodorTotev
710997d494
refactor(with-sentry): example (#13434)
1. I updated all the packages.
2. Refactored the home component from class to functional
3. Example now uses getServerSideProps instead of getInitialProps
2020-05-27 16:11:46 +00:00
TodorTotev
8618ab85ad
More redundant imports @ examples (#13190)
Again, related to [12964](https://github.com/zeit/next.js/issues/12964)

After checking all the other examples and the ongoing pull requests, I believe that with this PR being merged, all the examples should be free of redundant react imports.
Let me know if you want me to edit anything that you don't like.

Regards

with-typescript
with-atstroturf
with-atlaskit
with-styletron
with-styled-components-rtl
with-stylesheet
with-stomp
with-stitches-styled
with-stitches
with-slate
with-sentry-simple
with-sentry
with-segment-analytics
with-rematch
with-relay-modern
with-reflux
with-redux-wrapper
with-react-relay-network
with-react-native
with-react-multi-carousel
with-react-jss
with-react-helmet
with-react-ga
with-quill-js
with-prefetching
with-google-analytics-amp
with-google-analytics
with-framer-motion
with-flow
with-firebase-hosting
with-firebase-cloud-messaging
with-firebase-authentication
with-expo
with-dynamic-app-layout
with-draft-js
with-cxs
with-cerebral
with-ant-design-mobile
with-algolia-react-instantsearch
using-preact
progressive-render
2020-05-22 15:33:04 +00:00
Joe Haddad
18a9c7e371
Improve linting rules to catch more errors (#9374)
* Update `packages/`

* Update examples

* Update tests

* Update bench

* Update top level files

* Fix build

* trigger
2019-11-10 19:24:53 -08:00
Corbin Crutchley
e03266008c form handler example: Update deps and fix build from dep update (#6732)
* form handler example: Update deps and fix build from dep update

* Ran lint error fixers

* Fixes errors that occur when commit occurs

* Commit linter fixes
2019-03-27 16:12:45 -04:00
Václav Nosek
02966afd5a [with-sentry] example: Make 'utils/sentry.js' more flexible (#6769)
* Make `ctx` optional in `captureException` function

* Make 'release' optional when calling sentry util

* Fix code style
2019-03-27 13:23:34 +01:00
Jess Telford
ecbecb9edb Fixes for with-sentry example (#6362) 2019-02-20 14:49:16 +01:00
Tim Neutkens
163830c026 Merge branch 'canary'
# Conflicts:
#	examples/with-apollo-and-redux/README.md
#	examples/with-sentry/README.md
#	examples/with-sentry/package.json
#	examples/with-sentry/pages/_app.js
#	package.json
#	packages/next/build/webpack-config.js
#	packages/next/client/index.js
#	server/document.js
#	server/render.js
#	test/integration/production/test/index.test.js
2019-02-11 08:22:31 +01:00
Tim Neutkens
9c4eefcdbf
Add prettier for examples directory (#5909)
* Add prettier for examples directory

* Fix files

* Fix linting

* Add prettier script in case it has to be ran again
2018-12-17 17:34:32 +01:00
Adam Stankiewicz
cd1d3640a9 Improve with-sentry example (#5727)
* Improve with-sentry example

* remove nonexisting keys from request and update errorInfo handling

* readd query and pathname

* read query and params and add pathname and query to client
2018-12-10 23:59:12 +01:00
Arek Mytych
5276734535 Update to use @sentry/browser, remove raven-js (#5253) 2018-09-22 14:22:24 +02:00
Tomek
b1459bfd60 update with-sentry example (#4859)
Changes:

* moved the configuration from HOC to `_app.js`
* fixed the example, as `componentDidCatch` catches errors during rendering phase, but not within event handlers.
2018-08-04 10:51:35 -07:00
Leandro Ardissone
a35e747e24 Added Sentry.io example (#3215)
* Added Sentry example

* Code style fixes

* Fixes docs + removed demo DSN + send error to comp
2017-11-04 15:06:16 +01:00