[ ] Make SENTRY_DSN configurable through an environment variable.
[ ] Only include Sentry if SENTRY_DSN is defined (this makes it optional per project).
[ ] In the browser only load Sentry on error to improve performance. Note: this does mean events leading up to the error (like navigation and scrolling) are not tracked.
[ ] On the server use toucan-js to handle errors. Ideally this is wrapped around all dynamic endpoints and pages in src/middleware.ts.
[ ] Update GitHub PR template to mention resolved Sentry issues (like we do with GitHub issues) so that the Sentry Release GitHub Action automatically picks it up and resolves it in Sentry.
[ ] Document setup in docs/getting-started.md? (see #71)
[ ] Add decision on why we're using Sentry like this to the decision log? (also see note below about alternative considered)
Note: Sentry provides an official @sentry/astro package. However that wraps @sentry/browser and @sentry/node. We can't use the Node.js package as it's incompatible with Cloudflare. And we don't want the browser package to be loaded always and directly (see point about conditional loading and performance). But the package is a good reference for implementation and use of Astro middleware.
Questions
Do we also want to use Sentry to monitor performance (can be used both server- and client-side)? What does this mean for our loading strategy? And what does this mean for running costs?
User Story
As a developer, I want run-time errors to be accessible somewhere, so that I can review and fix them.
System design
SENTRY_DSN
configurable through an environment variable.SENTRY_DSN
is defined (this makes it optional per project).toucan-js
to handle errors. Ideally this is wrapped around all dynamic endpoints and pages insrc/middleware.ts
.docs/getting-started.md
? (see #71)Note: Sentry provides an official
@sentry/astro
package. However that wraps@sentry/browser
and@sentry/node
. We can't use the Node.js package as it's incompatible with Cloudflare. And we don't want the browser package to be loaded always and directly (see point about conditional loading and performance). But the package is a good reference for implementation and use of Astro middleware.Questions