Skip to content

Add sentry error reporting #2309

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

Merged
merged 5 commits into from
Jul 24, 2025
Merged

Add sentry error reporting #2309

merged 5 commits into from
Jul 24, 2025

Conversation

ericallam
Copy link
Member

No description provided.

Copy link

changeset-bot bot commented Jul 24, 2025

⚠️ No Changeset found

Latest commit: 99bfb96

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented Jul 24, 2025

Walkthrough

This change set integrates Sentry error tracking and monitoring into a Remix-based web application. It updates the build process, Dockerfile, and GitHub workflow to include Sentry-specific build arguments, secrets, and source map generation and upload. The runtime is enhanced with a new Sentry initialization module and improved error handling that wraps existing error handlers with Sentry reporting. Logger functionality is extended to capture and report errors to Sentry globally. A new admin-only API route simulates errors for testing. Dependencies are updated to add Sentry packages and remove a previous monitoring tool. A shell script automates source map uploads to Sentry during deployment.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–25 minutes

Complexity label: Moderate
Reasoning: The changes involve multiple interconnected areas including build configuration, secret management, runtime error handling, logging enhancements, new routes, and dependency updates. Each change is individually straightforward but collectively requires careful review to ensure secure handling of secrets, correct integration of Sentry features, and proper coordination between build and runtime components. The scope and cross-cutting nature justify a moderate review effort.

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ce9f8e3 and 99bfb96.

📒 Files selected for processing (1)
  • docker/Dockerfile (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • docker/Dockerfile
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (25)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 10)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 10)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 10)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (10, 10)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 10)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (8, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 10)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 10)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 10)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 10)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (9, 10)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
  • GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - npm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: typecheck / typecheck
  • GitHub Check: Analyze (javascript-typescript)
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-sentry-error-reporting

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/webapp/app/routes/admin.api.v1.simulate-error.ts (1)

11-11: LGTM! Simple error simulation for testing.

The intentional error throw serves its purpose for testing Sentry integration. Consider making the error message more descriptive to help distinguish it in error reports.

Consider making the error message more descriptive:

-  throw new Error("Test error");
+  throw new Error("Simulated error for testing Sentry integration");
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 74808d7 and ce9f8e3.

⛔ Files ignored due to path filters (6)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • references/effect/.gitignore is excluded by !references/**
  • references/effect/package.json is excluded by !references/**
  • references/effect/src/trigger/effect.ts is excluded by !references/**
  • references/effect/trigger.config.ts is excluded by !references/**
  • references/effect/tsconfig.json is excluded by !references/**
📒 Files selected for processing (10)
  • .github/workflows/publish-webapp.yml (1 hunks)
  • apps/webapp/app/entry.server.tsx (2 hunks)
  • apps/webapp/app/routes/admin.api.v1.simulate-error.ts (1 hunks)
  • apps/webapp/app/services/logger.server.ts (1 hunks)
  • apps/webapp/package.json (5 hunks)
  • apps/webapp/sentry.server.ts (1 hunks)
  • apps/webapp/server.ts (1 hunks)
  • apps/webapp/upload-sourcemaps.sh (1 hunks)
  • docker/Dockerfile (2 hunks)
  • packages/core/src/logger.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Always prefer using isomorphic code like fetch, ReadableStream, etc. instead of Node.js specific code
For TypeScript, we usually use types over interfaces
Avoid enums
No default exports, use function declarations

Files:

  • apps/webapp/server.ts
  • apps/webapp/app/routes/admin.api.v1.simulate-error.ts
  • apps/webapp/sentry.server.ts
  • apps/webapp/app/entry.server.tsx
  • apps/webapp/app/services/logger.server.ts
  • packages/core/src/logger.ts
{packages/core,apps/webapp}/**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

We use zod a lot in packages/core and in the webapp

Files:

  • apps/webapp/server.ts
  • apps/webapp/app/routes/admin.api.v1.simulate-error.ts
  • apps/webapp/sentry.server.ts
  • apps/webapp/app/entry.server.tsx
  • apps/webapp/app/services/logger.server.ts
  • packages/core/src/logger.ts
apps/webapp/**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/webapp.mdc)

apps/webapp/**/*.{ts,tsx}: In the webapp, all environment variables must be accessed through the env export of env.server.ts, instead of directly accessing process.env.
When importing from @trigger.dev/core in the webapp, never import from the root @trigger.dev/core path; always use one of the subpath exports as defined in the package's package.json.

Files:

  • apps/webapp/server.ts
  • apps/webapp/app/routes/admin.api.v1.simulate-error.ts
  • apps/webapp/sentry.server.ts
  • apps/webapp/app/entry.server.tsx
  • apps/webapp/app/services/logger.server.ts
apps/webapp/app/services/**/*.server.ts

📄 CodeRabbit Inference Engine (.cursor/rules/webapp.mdc)

For testable services, separate service logic and configuration, as exemplified by realtimeClient.server.ts (service) and realtimeClientGlobal.server.ts (configuration).

Files:

  • apps/webapp/app/services/logger.server.ts
🧠 Learnings (9)
apps/webapp/server.ts (9)

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-07-18T17:49:47.168Z
Learning: Applies to apps/webapp/app/**/*.test.{ts,tsx} : Test files in the webapp should not import env.server.ts, either directly or indirectly. Tests should only import classes and functions from files matching app/**/*.ts of the webapp, and those files should not use environment variables directly; everything should be passed through as options instead.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-07-18T17:49:47.168Z
Learning: Applies to apps/webapp/**/*.{ts,tsx} : In the webapp, all environment variables must be accessed through the env export of env.server.ts, instead of directly accessing process.env.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-07-18T17:49:47.168Z
Learning: Applies to apps/webapp/**/*.{ts,tsx} : When importing from @trigger.dev/core in the webapp, never import from the root @trigger.dev/core path; always use one of the subpath exports as defined in the package's package.json.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-07-18T17:49:47.168Z
Learning: Applies to apps/webapp/app/v3/presenters/**/*.server.ts : Favor the use of 'presenters' to move complex loader code into a class, as seen in app/v3/presenters/**/*.server.ts.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-07-18T17:49:47.168Z
Learning: Applies to apps/webapp/app/services/**/*.server.ts : For testable services, separate service logic and configuration, as exemplified by realtimeClient.server.ts (service) and realtimeClientGlobal.server.ts (configuration).

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-07-18T17:49:47.168Z
Learning: Applies to apps/webapp/app/**/*.test.{ts,tsx} : Tests in the webapp should only import classes and functions from files matching app/**/*.ts, and those files should not use environment variables directly; all configuration should be passed as options.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-18T17:49:24.458Z
Learning: Applies to {packages/core,apps/webapp}/**/*.{ts,tsx} : We use zod a lot in packages/core and in the webapp

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-18T17:49:24.458Z
Learning: Applies to **/*.{ts,tsx} : No default exports, use function declarations

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:24.984Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : Tasks must be exported, even subtasks in the same file.

apps/webapp/app/routes/admin.api.v1.simulate-error.ts (2)

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-07-18T17:49:47.168Z
Learning: Applies to apps/webapp/app/v3/presenters/**/*.server.ts : Favor the use of 'presenters' to move complex loader code into a class, as seen in app/v3/presenters/**/*.server.ts.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-07-18T17:49:47.168Z
Learning: Applies to apps/webapp/app/**/*.test.{ts,tsx} : Tests in the webapp should only import classes and functions from files matching app/**/*.ts, and those files should not use environment variables directly; all configuration should be passed as options.

.github/workflows/publish-webapp.yml (2)

Learnt from: nicktrn
PR: #2195
File: .github/workflows/release-helm.yml:42-46
Timestamp: 2025-06-25T13:24:23.836Z
Learning: In .github/workflows/release-helm.yml, the user nicktrn confirmed that using 'entrypoint' with 'docker://' steps works fine, contrary to previous analysis suggesting it's unsupported.

Learnt from: zvictor
PR: #1686
File: packages/build/src/extensions/python.ts:110-116
Timestamp: 2025-02-10T10:56:31.402Z
Learning: In Docker build contexts for Trigger.dev extensions, avoid over-engineering security measures when handling user-provided configuration (like Python requirements) as the build context is already isolated and the content is user-controlled.

apps/webapp/sentry.server.ts (3)

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-07-18T17:49:47.168Z
Learning: Applies to apps/webapp/**/*.{ts,tsx} : In the webapp, all environment variables must be accessed through the env export of env.server.ts, instead of directly accessing process.env.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-07-18T17:49:47.168Z
Learning: Applies to apps/webapp/app/services/**/*.server.ts : For testable services, separate service logic and configuration, as exemplified by realtimeClient.server.ts (service) and realtimeClientGlobal.server.ts (configuration).

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-07-18T17:49:47.168Z
Learning: Applies to apps/webapp/app/**/*.test.{ts,tsx} : Test files in the webapp should not import env.server.ts, either directly or indirectly. Tests should only import classes and functions from files matching app/**/*.ts of the webapp, and those files should not use environment variables directly; everything should be passed through as options instead.

apps/webapp/app/entry.server.tsx (1)

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-07-18T17:49:47.168Z
Learning: Applies to apps/webapp/**/*.{ts,tsx} : In the webapp, all environment variables must be accessed through the env export of env.server.ts, instead of directly accessing process.env.

apps/webapp/app/services/logger.server.ts (4)

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:24.984Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : When logging in tasks, use the logger API (logger.debug, logger.log, logger.info, logger.warn, logger.error) as shown.

Learnt from: nicktrn
PR: #1353
File: apps/webapp/app/v3/services/alerts/deliverAlert.server.ts:76-76
Timestamp: 2024-10-12T01:08:24.066Z
Learning: When extending the Error class in JavaScript/TypeScript, it's not necessary to manually set the name property because it defaults to the class name.

Learnt from: nicktrn
PR: #1353
File: apps/webapp/app/v3/services/alerts/deliverAlert.server.ts:76-76
Timestamp: 2024-09-25T09:55:36.536Z
Learning: When extending the Error class in JavaScript/TypeScript, it's not necessary to manually set the name property because it defaults to the class name.

Learnt from: nicktrn
PR: #1418
File: packages/core/src/v3/errors.ts:364-371
Timestamp: 2024-10-18T15:41:52.352Z
Learning: In packages/core/src/v3/errors.ts, within the taskRunErrorEnhancer function, error.message is always defined, so it's safe to directly call error.message.includes("SIGTERM") without additional checks.

docker/Dockerfile (5)

Learnt from: zvictor
PR: #1686
File: packages/build/src/extensions/python.ts:110-116
Timestamp: 2025-02-10T10:56:31.402Z
Learning: In Docker build contexts for Trigger.dev extensions, avoid over-engineering security measures when handling user-provided configuration (like Python requirements) as the build context is already isolated and the content is user-controlled.

Learnt from: zvictor
PR: #1686
File: packages/build/src/extensions/python.ts:85-87
Timestamp: 2025-02-10T10:54:17.345Z
Learning: In Python-related Dockerfiles for trigger.dev, avoid adding explicit Python version pinning as the base image already provides conservative version management. Additional pinning would unnecessarily slow down builds.

Learnt from: nicktrn
PR: #1306
File: .github/workflows/publish-worker.yml:49-61
Timestamp: 2024-09-23T13:34:24.714Z
Learning: In this project, the Docker builds are already fast, and optimizations using BuildKit's cache are unnecessary.

Learnt from: nicktrn
PR: #1306
File: .github/workflows/publish-worker.yml:49-61
Timestamp: 2024-10-12T01:08:24.066Z
Learning: In this project, the Docker builds are already fast, and optimizations using BuildKit's cache are unnecessary.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/executing-commands.mdc:0-0
Timestamp: 2025-07-18T17:49:29.224Z
Learning: Almost all commands in the monorepo should be executed using pnpm run ... from the root of the monorepo.

packages/core/src/logger.ts (6)

Learnt from: nicktrn
PR: #1418
File: packages/core/src/v3/errors.ts:364-371
Timestamp: 2024-10-18T15:41:52.352Z
Learning: In packages/core/src/v3/errors.ts, within the taskRunErrorEnhancer function, error.message is always defined, so it's safe to directly call error.message.includes("SIGTERM") without additional checks.

Learnt from: nicktrn
PR: #1387
File: packages/cli-v3/src/executions/taskRunProcess.ts:408-413
Timestamp: 2024-10-12T01:08:24.066Z
Learning: In the parseExecuteError method in packages/cli-v3/src/executions/taskRunProcess.ts, using String(error) to populate the message field works fine and even prepends error.name.

Learnt from: nicktrn
PR: #1387
File: packages/cli-v3/src/executions/taskRunProcess.ts:408-413
Timestamp: 2024-10-07T10:32:30.100Z
Learning: In the parseExecuteError method in packages/cli-v3/src/executions/taskRunProcess.ts, using String(error) to populate the message field works fine and even prepends error.name.

Learnt from: nicktrn
PR: #1353
File: apps/webapp/app/v3/services/alerts/deliverAlert.server.ts:76-76
Timestamp: 2024-10-12T01:08:24.066Z
Learning: When extending the Error class in JavaScript/TypeScript, it's not necessary to manually set the name property because it defaults to the class name.

Learnt from: nicktrn
PR: #1353
File: apps/webapp/app/v3/services/alerts/deliverAlert.server.ts:76-76
Timestamp: 2024-09-25T09:55:36.536Z
Learning: When extending the Error class in JavaScript/TypeScript, it's not necessary to manually set the name property because it defaults to the class name.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:24.984Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : When logging in tasks, use the logger API (logger.debug, logger.log, logger.info, logger.warn, logger.error) as shown.

apps/webapp/package.json (12)

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/executing-commands.mdc:0-0
Timestamp: 2025-07-18T17:49:29.224Z
Learning: Almost all commands in the monorepo should be executed using pnpm run ... from the root of the monorepo.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:24.984Z
Learning: Applies to trigger.config.ts : Build extensions such as additionalFiles, additionalPackages, aptGet, emitDecoratorMetadata, prismaExtension, syncEnvVars, puppeteer, ffmpeg, and esbuildPlugin must be configured in trigger.config.ts as shown.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:24.984Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : ALWAYS generate Trigger.dev tasks using the task function from @trigger.dev/sdk/v3 and export them as shown in the correct pattern.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:24.984Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : You MUST use @trigger.dev/sdk/v3 when writing Trigger.dev tasks.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:24.984Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : The run function contains your task logic in Trigger.dev tasks.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-18T17:49:24.458Z
Learning: Applies to **/*.test.{ts,tsx} : Our tests are all vitest

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-07-18T17:49:24.458Z
Learning: Applies to internal-packages/database/**/*.{ts,tsx} : We use prisma in internal-packages/database for our database interactions using PostgreSQL

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:24.984Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : Tasks must be exported, even subtasks in the same file.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:24.984Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : When using retry, queue, machine, or maxDuration options, configure them as shown in the examples for Trigger.dev tasks.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:24.984Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : You MUST export every task, including subtasks, in Trigger.dev task files.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:24.984Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : When implementing scheduled (cron) tasks, use schedules.task from @trigger.dev/sdk/v3 and follow the shown patterns.

Learnt from: CR
PR: triggerdotdev/trigger.dev#0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-07-18T17:50:24.984Z
Learning: Applies to /trigger//*.{ts,tsx,js,jsx} : When triggering a task from backend code, use tasks.trigger, tasks.batchTrigger, or tasks.triggerAndPoll as shown in the examples.

🧬 Code Graph Analysis (2)
apps/webapp/app/routes/admin.api.v1.simulate-error.ts (1)
apps/webapp/app/services/session.server.ts (1)
  • requireUser (39-62)
apps/webapp/app/entry.server.tsx (4)
packages/core/src/logger.ts (1)
  • error (69-77)
apps/webapp/app/services/logger.server.ts (1)
  • logger (49-59)
apps/webapp/app/v3/tracer.server.ts (1)
  • logger (101-106)
packages/cli-v3/src/utilities/logger.ts (1)
  • logger (113-113)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (25)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 10)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 10)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (10, 10)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 10)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 10)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (8, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (9, 10)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 10)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 10)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 10)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 10)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
  • GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
  • GitHub Check: typecheck / typecheck
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - npm)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (22)
packages/core/src/logger.ts (2)

26-27: LGTM! Clean implementation of error callback hook.

The static onError callback provides a clean way to integrate external error reporting without modifying the core logging logic.


74-76: LGTM! Proper callback invocation with null-safe check.

The callback is correctly invoked after logging with proper null checking to prevent runtime errors.

apps/webapp/server.ts (1)

1-1: LGTM! Correct placement of Sentry initialization.

The Sentry import is properly placed at the very beginning to ensure error tracking is initialized before any other application code runs.

apps/webapp/app/routes/admin.api.v1.simulate-error.ts (2)

1-2: LGTM! Proper imports for authentication and Remix types.

The imports correctly use the session service and Remix types as expected.


4-9: LGTM! Proper admin authorization check.

The authentication and authorization logic is correct - requiring a user and checking admin status with an appropriate 403 response for non-admins.

.github/workflows/publish-webapp.yml (2)

89-91: LGTM! Proper Sentry build arguments configuration.

The build arguments correctly configure Sentry with the git SHA as release identifier and appropriate organization/project values.


92-93: LGTM! Secure secret handling for Sentry authentication.

The secret is properly referenced from repository secrets and passed securely to the build process.

apps/webapp/upload-sourcemaps.sh (2)

1-2: LGTM! Proper shell script error handling setup.

The script correctly uses set -eo pipefail for robust error handling.


4-13: LGTM! Comprehensive environment validation and Sentry integration.

The script properly validates all required environment variables and provides clear feedback when they're missing. The Sentry CLI workflow (create release, inject, upload, cleanup) follows best practices.

apps/webapp/app/entry.server.tsx (2)

19-19: Good Sentry integration import.

The import of wrapHandleErrorWithSentry is correctly placed and follows the expected Sentry Remix integration pattern.


174-188: Well-structured error handling with contextual logging.

The implementation properly:

  • Wraps the error handler with Sentry for automatic error capture
  • Provides conditional request context when available
  • Uses structured logging with the existing logger service
  • Handles both Request objects and other error contexts appropriately
apps/webapp/app/services/logger.server.ts (3)

6-6: Good Sentry import for error reporting.

Correctly imports the necessary Sentry functions for capturing exceptions and messages.


14-30: Excellent integration with Logger's error callback system.

The implementation:

  • Properly hooks into the Logger's onError callback mechanism
  • Intelligently detects Error objects vs plain messages
  • Provides rich context through the extra field
  • Uses appropriate Sentry capture methods for different scenarios

32-48: Clean and focused helper functions.

Both extractErrorFromArgs and flattenArgs are:

  • Well-named and single-purpose
  • Handle edge cases appropriately (undefined args)
  • Use appropriate type checking for Error objects
  • Follow functional programming patterns
docker/Dockerfile (3)

45-45: Good addition of required packages.

Adding ca-certificates is appropriate for secure HTTPS connections during the Sentry source map upload process.


50-57: Excellent security improvement with secrets handling.

The changes properly:

  • Add necessary Sentry build arguments
  • Remove sensitive SENTRY_AUTH_TOKEN from build args
  • Use environment variables for non-sensitive Sentry configuration
  • Prepare for secure token handling via Docker secrets

73-75: Secure implementation of Sentry auth token handling.

The use of Docker secrets mount for SENTRY_AUTH_TOKEN is a security best practice that:

  • Prevents the token from appearing in build history
  • Avoids exposure in environment variables
  • Follows Docker's recommended secrets handling approach
apps/webapp/package.json (5)

7-7: Good build script sequencing.

The modification to run source map upload after all build steps is appropriate and ensures source maps are generated before upload.


9-11: Proper source map generation enabled.

Adding --sourcemap flags to both remix and server builds correctly enables source map generation for Sentry error tracking with proper source code context.


23-23: Clean source map upload integration.

The new upload:sourcemaps script properly delegates to a bash script, maintaining separation of concerns and allowing for more complex upload logic.


104-105: Appropriate Sentry dependencies added.

The addition of:

  • @sentry/node-native for native Node.js integrations
  • @sentry/remix for Remix-specific Sentry features

These are the correct packages for comprehensive Sentry integration in a Remix application.


220-220: Correct Sentry CLI addition.

Adding @sentry/cli as a devDependency is appropriate for build-time source map uploads and release management.

@matt-aitken matt-aitken merged commit 09d0e80 into main Jul 24, 2025
33 checks passed
@matt-aitken matt-aitken deleted the add-sentry-error-reporting branch July 24, 2025 14:09
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.

2 participants