GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(nuxt): Add server error hook by s1gr1d · Pull Request #12796 · getsentry/sentry-javascript

Conversation

@s1gr1d

@s1gr1d s1gr1d commented Jul 8, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Reports errors thrown in nitro. Tests will be added when adding the E2E test application.

closes #12795

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@s1gr1d
s1gr1d requested review from Lms24, andreiborza and lforst July 8, 2024 12:55
s1gr1d added 2 commits July 8, 2024 14:56
@s1gr1d
feat(nuxt): Add server error hook
dcadf22
@s1gr1d
add hint data
85359f8
@s1gr1d
s1gr1d force-pushed the sig/nuxt-server branch from 48c34df to 85359f8 Compare July 8, 2024 12:57
AbhiPrasad
AbhiPrasad reviewed Jul 8, 2024
View reviewed changes
Comment thread packages/nuxt/src/runtime/plugins/sentry.server.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@s1gr1d
s1gr1d requested a review from AbhiPrasad July 8, 2024 14:28
s1gr1d added 2 commits July 8, 2024 16:36
@s1gr1d
Update packages/nuxt/src/runtime/plugins/sentry.server.ts
d77c2e5
@s1gr1d
Merge branch 'develop' into sig/nuxt-server
a374ce5
lforst
lforst reviewed Jul 8, 2024
View reviewed changes
Comment thread packages/nuxt/src/runtime/plugins/sentry.server.ts Outdated

if (context) {
captureException(error, {
captureContext: { contexts: { nuxt: context } },

@lforst lforst Jul 8, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

m: I would be more selective in what we record here instead of dumping the entire context object in here. It could become a problem if context suddenly starts containing PII, becomes very large, or circular in a future nitro update.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@AbhiPrasad AbhiPrasad Jul 8, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

yes ideally we:

  1. We parse the incoming nuxt context and extract the fields we care about
  2. We put that in a nuxt context attached to the sentry event
  3. Document the nuxt context in the develop docs

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@s1gr1d
extract structured context
795d1ea
@s1gr1d
s1gr1d requested a review from lforst July 9, 2024 08:35
@s1gr1d
Merge branch 'develop' into sig/nuxt-server
cea2347
@s1gr1d s1gr1d mentioned this pull request Jul 9, 2024
build(nuxt): Add nuxt to craft #12821
Merged
@s1gr1d
fix test
9a6f43c
@s1gr1d s1gr1d added the Package: nuxt label Jul 9, 2024
lforst
lforst approved these changes Jul 9, 2024
View reviewed changes

@lforst lforst left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

:shipit:

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/nuxt/src/runtime/plugins/sentry.server.ts
Comment on lines +8 to +13
// Do not handle 404 and 422
if (error instanceof H3Error) {
if (error.statusCode === 404 || error.statusCode === 422) {
return;
}
}

@lforst lforst Jul 9, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

l/m: We could arguably skip all 4xxs (also 3xxs if that can ever happen).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Lms24
Lms24 approved these changes Jul 9, 2024
View reviewed changes

@Lms24 Lms24 left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Two optional suggestion to streamline the code but otherwise LGTM! (feel free to merge and streamline in a follow-up PR or not at all)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/nuxt/src/runtime/plugins/sentry.server.ts Outdated
Comment on lines +15 to +24
if (errorContext) {
const structuredContext = extractErrorContext(errorContext);

captureException(error, {
captureContext: { contexts: { nuxt: structuredContext } },
mechanism: { handled: false },
});
} else {
captureException(error, { mechanism: { handled: false } });
}

@Lms24 Lms24 Jul 9, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

l (feel free to disregard): WDYT about calling captureException only once and setting captureContext depending on errorContext

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/nuxt/src/runtime/utils.ts
tags: undefined,
};

if (errorContext) {

@Lms24 Lms24 Jul 9, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

l: do we need this guard? i.e. can CapturedErrorContext be undefined?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
s1gr1d and others added 2 commits July 9, 2024 15:25
@s1gr1d
review changes
1af2673
@s1gr1d
Merge branch 'develop' into sig/nuxt-server
165cf5e
@s1gr1d
s1gr1d merged commit 47e1b7e into develop Jul 9, 2024
@s1gr1d
s1gr1d deleted the sig/nuxt-server branch July 9, 2024 13:43
s1gr1d added a commit that referenced this pull request Jul 9, 2024
@s1gr1d
build(nuxt): Add nuxt to craft (#12821)
6da0728
Preparing `@sentry/nuxt` for a release (experimental)

Merge after this PR:
#12796
This was referenced Jul 30, 2024
[Snyk] Upgrade @sentry/react from 7.16.0 to 8.16.0 https-quantumblockchainai-atlassian-net/ossinsight#787
Open
[Snyk] Upgrade @sentry/react from 7.16.0 to 8.17.0 https-quantumblockchainai-atlassian-net/ossinsight#791
Open
@amykapernick amykapernick mentioned this pull request Aug 1, 2024
[Snyk] Upgrade @sentry/nextjs from 8.14.0 to 8.17.0 amykapernick/wedding#12
Open
@wkylin wkylin mentioned this pull request Aug 1, 2024
[Snyk] Upgrade @sentry/react from 8.15.0 to 8.17.0 wkylin/pro-react-admin#370
Closed
@q1blue q1blue mentioned this pull request Aug 6, 2024
[Snyk] Upgrade @sentry/react from 7.16.0 to 8.18.0 https-quantumblockchainai-atlassian-net/ossinsight#799
Open
@wkylin wkylin mentioned this pull request Aug 7, 2024
[Snyk] Upgrade @sentry/react from 8.15.0 to 8.18.0 wkylin/pro-react-admin#371
Merged
This was referenced Aug 9, 2024
[Snyk] Upgrade @sentry/react from 7.118.0 to 8.19.0 Stanislav1975/win11React#4
Open
[Snyk] Upgrade @sentry/node from 6.17.4 to 8.19.0 Stanislav1975/shields#596
Open
@q1blue q1blue mentioned this pull request Aug 9, 2024
[Snyk] Upgrade @sentry/react from 7.16.0 to 8.19.0 https-quantumblockchainai-atlassian-net/ossinsight#802
Open
@FengShangWuQi FengShangWuQi mentioned this pull request Aug 11, 2024
[Snyk] Upgrade @sentry/gatsby from 7.20.0 to 8.19.0 FengShangWuQi/fengshangwuqi.github.io#1914
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Lms24 Lms24 Lms24 approved these changes
@andreiborza andreiborza Awaiting requested review from andreiborza
@AbhiPrasad AbhiPrasad Awaiting requested review from AbhiPrasad
+1 more reviewer
@lforst lforst lforst approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Add server (nitro) instrumentation

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@s1gr1d @lforst @Lms24 @AbhiPrasad
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.