Commit graph

83 commits

Author SHA1 Message Date
Steven Eubank
d3c292dd4a
Update with-sentry README.md Next.js version (#44374)
Clarify requirement and move down, since Next.js versions <10 are already quite dated
2022-12-27 14:40:43 +00:00
Tim Neutkens
ab42da0626
Run next/link codemod for Next.js 13 on examples (#41913) 2022-10-30 21:00:45 +01:00
Craig Wheeler
57426a2849
Update Examples to use React 18 (#42027)
This PR updates the minimum version of React used by examples from 17.0.2 to 18.2.0.

Fixes #41975

## Bug

- [x] Related issues linked using `fixes #41975`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm build && 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)
2022-10-28 17:43:20 +00: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
77e7529dfe
ref(with-sentry example): Explicitly set hideSourceMaps (#40079)
This adds a default value for `hideSourceMaps` to the `next.config.js` the `with-sentry` example app provides, so that new users will use `hidden-source-map` as their Webpack `devtool` by default in client-side builds. (This prevents browser devtools from seeing sourcemaps and therefore prevents original source code from showing up automatically in the `Sources` tab. (More information on `devtool` values can be found [here](https://webpack.js.org/configuration/devtool/).)

In conjunction with https://github.com/getsentry/sentry-javascript/pull/5649, https://github.com/getsentry/sentry-wizard/pull/188, and https://github.com/getsentry/sentry-docs/pull/5464, this is the first step in addressing the concerns raised in https://github.com/getsentry/sentry-javascript/issues/4489. See [here](https://github.com/getsentry/sentry-javascript/issues/4489#issuecomment-1231137629) for more details.
2022-09-05 19:40:03 +00:00
JJ Kasper
0ab6ad5241
Update default gitignore templates (#39051) 2022-07-26 20:08:40 -05: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
Steven
57dcc9d329
Update pnpm create next-app for latest pnpm 6 and 7 (#37254)
This command changed in pnpm [6.32.13](https://github.com/pnpm/pnpm/releases/tag/v6.32.13) and [7.1.1](https://github.com/pnpm/pnpm/releases/tag/v7.1.1) so lets update it since its been a few weeks and we can expect pnpm users to update more regularly than npm users.

- Fixes https://github.com/vercel/next.js/pull/37240 
- Fixes https://github.com/vercel/next.js/pull/37045
- Fixes https://github.com/vercel/next.js/pull/37032
- Fixes https://github.com/vercel/next.js/pull/36602
- Fixes https://github.com/vercel/next.js/pull/36496
2022-05-27 21:21:40 +00:00
Kamil Ogórek
241c510e5b
docs(with-sentry): Add note regarding replacing wizardcopy.js config files (#37039) 2022-05-22 21:55:12 -05: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
Steven
9f9214abe5
Updated create-next-app docs to include pnpm usage (#35755)
This PR updates the docs and examples for `create-next-app` to include pnpm usage.

The following script was used to update every example README:

```js
const fs = require('fs')
const examples = fs.readdirSync('./examples')

for (let example of examples) {
    const filename = `./examples/${example}/README.md`
    const markdown = fs.readFileSync(filename, 'utf8')
    const regex = new RegExp(`^yarn create next-app --example (.*)$`, 'gm')
    const output = markdown.replace(regex, (yarn, group) => {
        const pnpm = `pnpm create next-app -- --example ${group}`
        return `${yarn}\n# or\n${pnpm}`
    })
    fs.writeFileSync(filename, output)
}
```
2022-03-30 21:03:21 +00:00
Jon Espen Kvisler
31d83852f8
Sentry example: add js types to SentryWebpackPluginOptions (#28726)
* Add js types to SentryWebpackPluginOptions

Enables code completion in Visual Studio Code (and perhaps other editors)

* Use partial type for SentryWebpackPluginOptions

This matches the expected type in e71454ef78/packages/nextjs/src/config/webpack.ts (L38)

* inline sentry config
2022-02-21 21:51:36 +01:00
MikevPeeren
dbe7f968b0
Update Sentry example readme to mention Next.js 12 support (#32724)
@sentry/nextjs support has changed as it now supports version from 10.0.8 also meaning they support Next.Js 12

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2021-12-22 20:08:05 +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
8fa5f34186
[examples] Fix deploy button URL in with-sentry example (#30112)
This updates the URL behind the "Deploy to Vercel" button in the readme of the `with-sentry` example. Changes which have been made:

- Addition of a required integration
- Removal of the required env var, as it's set by the integration

- [x] Make sure the linting passes
2021-10-20 18:21:12 +00: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
Luc Leray
f52955ec94
Clean up examples package.json (#27121)
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
2021-07-12 19:58:03 +00:00
Nick Babcock
5629223407
Update examples to use React 17 (#26133)
[With next 11 requiring react 17](https://nextjs.org/blog/next-11#upgrade-guide), most of the examples
need to be updated, so the following snippet updated all the examples to
a compatible react version.

```bash
cd examples/
fd -g 'package.json' | xargs sed -r -i 's/"react": ".*"/"react": "^17.0.2"/
fd -g 'package.json' | xargs sed -r -i 's/"react-dom": ".*"/"react-dom": "^17.0.2"/'

# exclude experimental react version
git checkout with-reason-relay/package.json
```
2021-06-16 16:43:26 +00:00
Dominic Elm
d2caaeab64
docs: add 'Open in StackBlitz' buttons to various examples (#25853)
This PR adds a `Preview` section and a `Open in StackBlitz` button to various examples. I have tested all examples and omitted the ones that require third party API keys, or didn't work. Some examples don't work locally either.

Here's an example:
![image](https://user-images.githubusercontent.com/12571019/121027783-88971280-c7a7-11eb-851a-0ad30cf74b42.png)

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [x] Examples updated
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [x] Make sure the linting passes
2021-06-08 20:45:02 +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
Ciprian Caba
919ac17f76
Update reference to commit sha (#23215)
VERCEL_GIT_COMMIT_SHA is now available by default across all integrations
2021-03-19 16:49:20 +00:00
Lee Robinson
e2cdf6d581
Update README for sentry example. (#23205)
The packages referenced here were removed.
2021-03-18 18:16: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
Robin
c47f3d84c4
Unify installation scripts for example apps (#19808) 2021-01-24 17:05:49 +01:00
Lee Robinson
dc87a8436b
Update redirected or broken Vercel docs links. (#21119) 2021-01-14 15:37:21 +00:00
Luc Leray
b442acbe1c
Replace zeit/next.js with vercel/next.js (#20849) 2021-01-07 08:41:04 -05:00
Luc Leray
8eaabe2fb0
Fix deploy buttons URLs (#20834)
Fix all deploy button URLs in the Next.js repo to follow the following format:
```
https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/<EXAMPLE_NAME>&project-name=<EXAMPLE_NAME>&repository-name=<EXAMPLE_NAME>
```

The detailed docs for the Deploy Button can be found here: https://vercel.com/docs/more/deploy-button.

Also updates legacy Vercel import flow URLs (starting with vercel.com/import or with vercel.com/new/project), to use the new vercel.com/new URLs.

---

For example, for the `hello-world` example:

The URL is https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/hello-world&project-name=hello-world&repository-name=hello-world

And the deploy button looks like this:
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/hello-world&project-name=hello-world&repository-name=hello-world)

---

For reference, I used the following regexes to search for the incorrect URLs

```
\(https://vercel.com/import/git\?s=https://github.com/vercel/next.js/tree/canary/examples/(.*)\)
\(https://vercel.com/import/git\?c=1&s=https://github.com/vercel/next.js/tree/canary/examples/([^&]*)(.*)\)
\(https://vercel.com/import/project\?template=https://github.com/vercel/next.js/tree/canary/examples/(.*)\)
https://vercel.com/import/git
https://vercel.com/import/select-scope
https://vercel.com/import
https://vercel.com/new/project
```
2021-01-07 01:40:29 +00:00
Luke Harries
16d464caf6
Fix withSourceMaps is not a function (#20643)
In order to get this example working, I needed to remove the invocation as described here: https://github.com/vercel/next-plugins/issues/309#issuecomment-674376348
2020-12-31 22:00:41 +00:00
Vishnu Paduchuri
ce4def79b3
Sentry URL for Organization (#20269)
Build Fails due to Invalid Token error, adding SENTRY_URL fixed the issue.
2020-12-18 09:07:23 +00:00
Vishnu Paduchuri
17b91e7c76
Spelling fix (#19686) 2020-11-30 18:53:13 +00:00
Lucas Varela
7fd04c956d
Add self-hosted information to with-sentry example (#18102)
* Add info about SENTRY_URL on source map uploading

* Update examples/with-sentry/README.md

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Luis Alvarez D <luis@vercel.com>
2020-11-11 19:47:11 -05: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
Kristoffer K
2acb53bd30
chore: update example names to match their folders (#16268)
**What's the problem this PR addresses?**

A decent amount of the examples don't have a `name` field in `package.json` that matches their folder name, meaning they either lack a name or the names are duplicated.

I was testing Yarn 2 workspaces using the entire examples directory and needed to get rid of the duplicates.

**How did you fix it?**

Updated the names to match the names of their folders
2020-09-05 21:23:51 +00:00
Joe Haddad
f17d435166
Ensure all examples are MIT licensed (#16691) 2020-08-29 22:32:35 -04:00
NorbertLuszkiewicz
c03d4931de
Simplify example usage instructions (#16678)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-08-29 22:22:02 -04:00
WeichienHung
c97e53efe1
basePath should also append in urlPrefix (#16376)
Fix https://github.com/vercel/next.js/issues/16197

See my screenshot. Testing url is changed to http://localhost:3000/test and can find the source map.
<img width="826" alt="圖片" src="https://user-images.githubusercontent.com/1462027/90737991-d74eeb00-e300-11ea-9675-f25aef6a4062.png">
2020-08-24 02:00:43 +00:00
Andrew Nagy
2301331703
Add stripPrefix of webpack://_N_E/ (#15955)
In with-sentry add stripPrefix of `webpack://_N_E/`. This removes the `webpack://_N_E/` prefix from the stack trace which will help Sentry to understand what is "App Only" vs "Full"

I'll fully tested calling errors in browser and the stack traces are still aligned and linked correctly. This just gets rid of the extra data in the front which seems to be the same for everyone and I believe it comes from webpack 5 (?)
2020-08-11 17:49:34 +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
Obed Marquez Parlapiano
5a00d62242
Correct order of packages in Sentry example explanation (#15334) 2020-07-20 14:46:25 -04:00
Necmettin Karakaya
c2f38f2af0
[Fix] common misspelling errors (#15288)
For reference: https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines
2020-07-19 04:38:20 +00:00
Luis Alvarez D
14eb907c60
[Examples] Improve with-sentry readme (#15205)
The current readme has wrong instructions and it's not clear enough about how to get the app running, also added deploy to Vercel buttons.
2020-07-17 00:58:43 +00:00
Tanmay Laud
f00ad581a1
Added .gitignore to examples that are deployed to vercel (#15127)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-07-16 10:52:23 -04:00
stefanprobst
279ae19c7e
docs: update links to docs site (#14305)
this updates some links to the docs site to their new location
2020-06-18 09:54:07 +00: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
Joe Haddad
7d038dfef1
Suggest npx over npm init (#13637)
This updates old examples to the more universal `npx` command.

Fixes https://github.com/vercel/next.js/discussions/12103
2020-06-01 17:36:57 +00:00
Joe Haddad
b7e17e09e5
Update references to zeit/next.js (#13463) 2020-05-27 17:51:11 -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