Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Update Sentry version and turn it on only for production #450

Merged
merged 5 commits into from
Nov 30, 2021

Conversation

obulat
Copy link
Contributor

@obulat obulat commented Nov 25, 2021

Fixes

Fixes #446 by @zackkrida

Description

This PR updates the @nuxtjs/sentry package version to the most recent one, 5.1.5, which uses Sentry SDK version 6.14.1, not the most recent6.15.0. It also loads Sentry only on production builds to make the development environment faster.

Testing Instructions

I only ran:

  1. npm ci
  2. npm run dev
  3. npm run build, npm run start. Locally, this raises a CORS error.
    After deploy, we can see if there are any problems (which there shouldn't be).

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@obulat obulat requested a review from a team as a code owner November 25, 2021 08:43
@obulat obulat added 💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix 🟧 priority: high Stalls work on the project or its dependents labels Nov 25, 2021
@obulat obulat self-assigned this Nov 25, 2021
nuxt.config.js Outdated
@@ -204,6 +204,7 @@ export default {
dsn:
process.env.SENTRY_DSN ||
'https://3f3e05dbe6994c318d1bf1c8bfcf71a1@o288582.ingest.sentry.io/1525413',
disabled: process.env.NODE_ENV !== 'production',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'll actually want to make this explicitly disabled locally somehow, because soon we'll have cloud staging and production environments and we'll want to have Sentry running on both.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a separate var like ENABLE_SENTRY? It'll allow Sentry to be enabled or disabled.

Copy link
Contributor

@sarayourfriend sarayourfriend left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Copy link
Member

@zackkrida zackkrida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, let's just make sure Sentry will still run on our cloud staging environment too.

nuxt.config.js Outdated
@@ -204,6 +204,7 @@ export default {
dsn:
process.env.SENTRY_DSN ||
'https://3f3e05dbe6994c318d1bf1c8bfcf71a1@o288582.ingest.sentry.io/1525413',
disabled: process.env.NODE_ENV !== 'production',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'll actually want to make this explicitly disabled locally somehow, because soon we'll have cloud staging and production environments and we'll want to have Sentry running on both.

@sarayourfriend
Copy link
Contributor

let's just make sure Sentry will still run on our cloud staging environment too

Why do we want Sentry in staging?

@zackkrida
Copy link
Member

let's just make sure Sentry will still run on our cloud staging environment too

Why do we want Sentry in staging?

My thinking was if there's errors getting logged while we're testing staging that we don't notice, that Sentry could help make those more visible. Just more assurance against bugs.

I'd frankly be happy to run it locally, too, but for the sake of devex and nuxt initialization speed (it can make a difference of a few seconds) I think it's fine to omit.

@sarayourfriend
Copy link
Contributor

If we're going to run it in staging should we make the sentry URL configurable and have a separate environment for staging? Or is there a way to partition the sentry dashboard by the source's host or something like that?

@zackkrida
Copy link
Member

Sentry has a concept of environments1 that by default uses process.env.NODE_ENV, but we should explicitly add configuration for it in our Sentry config, as described here: https://sentry.nuxtjs.org/sentry/options#config

Footnotes

  1. https://docs.sentry.io/product/sentry-basics/environments/

@obulat
Copy link
Contributor Author

obulat commented Nov 30, 2021

Sentry has a concept of environments1 that by default uses process.env.NODE_ENV, but we should explicitly add configuration for it in our Sentry config, as described here: https://sentry.nuxtjs.org/sentry/options#config

Footnotes

1. https://docs.sentry.io/product/sentry-basics/environments/ [↩](#user-content-fnref-2-4df0377d957d04b1a1b4b5ae601573ed)

@zackkrida , I have currently set the Sentry disabled when NODE_ENV is development, would it be development in staging environment, too?
I would definitely like to remove Sentry from dev, because it prevents the app from loading in Firefox. Or does it actually mean that we need to look into Sentry logs to find what the problem is?
Oh, and I don't understand how I can set the Sentry config environments ...

nuxt.config.js Show resolved Hide resolved
nuxt.config.js Show resolved Hide resolved
nuxt.config.js Outdated Show resolved Hide resolved
obulat and others added 2 commits November 30, 2021 19:25
Co-authored-by: Zack Krida <zackkrida@pm.me>
Co-authored-by: Zack Krida <zackkrida@pm.me>
@obulat obulat requested a review from zackkrida November 30, 2021 16:27
nuxt.config.js Outdated Show resolved Hide resolved
Copy link
Contributor

@sarayourfriend sarayourfriend left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 🤠

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix 🟧 priority: high Stalls work on the project or its dependents
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade to the latest version of the Sentry SDK
5 participants