web3.storage icon indicating copy to clipboard operation
web3.storage copied to clipboard

Implement Sentry for error logging

Open vasco-santos opened this issue 4 years ago • 5 comments

Current need

We need both error logging to improve diagnostics as well as error handling in the UI to improve UX.
This ticket covers implemeting Sentry to log errors. NFT.Storage currently uses Sentry for logging, thus makes sense to use this for web3 as well.
Related ticket of error handling (user feedback in UI) found in #1552

Original Request

The website should have a general error handler (perhaps with an Error page redirect?). There are occasions where we only test "expected" errors. Some examples are:

  • https://github.com/web3-storage/web3.storage/blob/website-v1.4.0/packages/website/pages/login.js#L48
  • https://github.com/web3-storage/web3.storage/blob/website-v1.4.0/packages/website/pages/files.js#L145

But a thrown error could be something else we don't expect. With this in mind, tsc states Catch clause variable type annotation must be 'any' or 'unknown' if specified and if we try to access properties of error we need to really test what the error is.

We should be able to identify if the error we caught is what we expected and show the message as we do, but be able to identify further errors and be able to react to them.

Context: https://github.com/web3-storage/web3.storage/pull/417#pullrequestreview-763125119

vasco-santos avatar Sep 24 '21 14:09 vasco-santos

Hey Vasco, can we get some more context for this one?

atopal avatar Oct 01 '21 14:10 atopal

Sent this over to @vasco-santos too:

We currently have a lot of catch statements that assume type which obviously isn't great. The title of the ticket says "Global Error handling" which makes me think of something like Sentry or Raygun as a way to catch and find out about errors impacting users, but neither is specified so I might be misreading this. Is the intent here to remove those fragile catch statement logging lines in favor of something like Sentry or Raygun and then redirect to an error page afterwards? Or something else?

drewdelano avatar Jun 22 '22 00:06 drewdelano

In part yes, we should definitely look into adding Sentry to w3s (we have it in nft.storage btw). But, would also like to see visual error states. For instance, today if an upload fails (or really any other error), we should show visual information to user, rather than do nothing and the error can only be seen in console

vasco-santos avatar Jun 22 '22 08:06 vasco-santos

Ok, this sounds like two parts. First part is implementing proper error handling to improve UX. The other part is logging these errors (Sentry).
I'm going to adjust scope of this ticket to focus on implementing Sentry error logging (so both nft and web3 errors are logged, improving diagnostics during error resolution).
I'll ticket separately the need to handle these errors in UI to improve UX. #1552

JeffLowe avatar Jun 22 '22 14:06 JeffLowe

I think all I'm currently missing here is getting the secrets setup in Github and CloudFlare. Asking around about how to get permissions to handle those now.

drewdelano avatar Jun 29 '22 18:06 drewdelano