Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): implement basic error reporting #6914

Merged
merged 6 commits into from
Jun 18, 2024
Merged

Conversation

rexxars
Copy link
Member

@rexxars rexxars commented Jun 12, 2024

Description

This introduces an error reporter using Sentry, for auto-updating, non-embedded studios. In the future, we may extend this to other studio types/configurations.

Review notes

  • Can be reviewed as a whole - I'll squash on merge
  • The only (seemingly) unrelated commit here is the first one, which changes the SANITY_VERSION constant from being a static 0.0.0-development to say 3.15.3-development. This is really only relevant for the monorepo, but is helpful in the context of error reporting to see what the "base" version is.
  • The Sentry relay is currently not working due to some CORS issues I am working to figure out, but the code aspect of this is ready for review.
  • I am aware of a few locations in the code that needs a few comments to clarify the purpose/rationale for them - I'll see if I can find the time to add them soon.
  • There is a new "Errors test" tool in the test studio that has five different error "causes", and can be triggered by clicking the respective buttons. Each of these should cause an error to be reported to Sentry (once the relay is working).
    • Thrown errors in event handlers (something that runs on click, for instance, and is not executed during rendering)
    • Type errors in event handlers (eg calling a method on undefined or similar)
    • Errors in timeouts (setTimeout/setImmediate/setInterval)
    • Unhandled rejections (promises without a catch handler)
    • Errors during React render cycle
  • Known limitations/areas to improve on:
    • Filtering errors that is not caused by Sanity. This needs more investigation in introspecting the stack trace etc - just have not had time to look at this yet, and can be added later.
    • (Potentially) add a flag to opt-out of error reporting
    • Add more context to reported errors - knowing more about the state of the application would help debug issues

Testing

We're currently missing tests. I'd like to add some playwright tests that trigger an error and verify that a network request to the Sentry relay is triggered, but have not had time yet. Will see if I can find time before merging this.

Notes for release

None, I think. Will double check if this should be called out or not.

Copy link

vercel bot commented Jun 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 17, 2024 2:59pm
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 17, 2024 2:59pm
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 17, 2024 2:59pm
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 17, 2024 2:59pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 17, 2024 2:59pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Jun 17, 2024 2:59pm

Copy link

socket-security bot commented Jun 12, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher

View full report↗︎

Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Jun 12, 2024

Component Testing Report Updated Jun 17, 2024 2:58 PM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 36s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 7s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 27s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 32s 11 7 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 14s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 9s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 29s 4 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 36s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 16s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 5s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 7s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 21s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 15s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 30s 12 0 0

Copy link
Contributor

@binoy14 binoy14 left a comment

Choose a reason for hiding this comment

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

Code looks good and tested in different situations and seems to be piping correctly. There is opportunity to improve source map detection but that can be follow up PRs. There seems to be a linting error and merge conflict. Once that is fixed happy to ✅ it

@rexxars
Copy link
Member Author

rexxars commented Jun 17, 2024

Rebased, lint and tests passing

Copy link
Contributor

@binoy14 binoy14 left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link

sentry-io bot commented Jun 24, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ Error: whatever throwError(@fs/Users/carolina/code/sanity/packa... View Issue

Did you find this useful? React with a 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants