agentleFS
SentryKnown publishergetsentry/n8n-nodes-sentry/CLAUDE.md

n8n-nodes-sentry

CLAUDE.md1 starsChanged 13 months agoMITView on GitHub

This is an n8n community node package for integrating Sentry with n8n workflows. The package provides a custom node that sends structured log messages to Sentry using the official @sentry/node SDK. It follows the n8n node development standards and uses TypeScript with strict type checking. The Sentry node allows users to send structured logs from n8n workflows to Sentry. Features include: - Configurable Sentry DSN (Data Source Name) - Support for all Sentry log levels: trace, debug, info, warn, error,…

The file

We split this CLAUDE.md into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use NodeOperationError for node-specific errors

    line 93
  2. Distinctive:

    Not stored as a credential since it's not a secret

    line 119

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Overview

This is an n8n community node package for integrating Sentry with n8n workflows. The package provides a custom node that sends structured log messages to Sentry using the official @sentry/node SDK. It follows the n8n node development standards and uses TypeScript with strict type checking.

What This Package Does

The Sentry node allows users to send structured logs from n8n workflows to Sentry. Features include:

  • Configurable Sentry DSN (Data Source Name)
  • Support for all Sentry log levels: trace, debug, info, warn, error, fatal
  • Custom message content
  • Dynamic key-value attributes for log metadata
  • Automatic log flushing to ensure delivery
  • Full error handling with n8n's continueOnFail support

Development Commands

# Bundle Sentry SDK (runs automatically during build)
npm run bundle

# Build the node (bundles SDK first, then compiles TypeScript)
npm run build

# Build with watch mode for development
npm run build:watch

# Run development server
npm run dev

# Run linter
npm run lint

# Fix linting issues
npm run lint:fix

Build Process

The build process uses Vite to bundle the @sentry/node SDK before TypeScript compilation:

  1. Bundle: Vite bundles @sentry/node into nodes/Sentry/sentry-sdk.bundle.js
  2. Compile: TypeScript compiles the node code, importing from the bundled SDK
  3. Copy: The bundled SDK files are copied to dist/nodes/Sentry/ for distribution
  4. Output: Final files are placed in dist/ directory

This bundling approach allows the package to work with n8n Cloud's linting rules while maintaining full SDK functionality.

Project Structure

The codebase follows n8n's standard node package structure:

  • nodes/Sentry/ - Contains the Sentry node implementation
    • Sentry.node.ts - Main node implementation implementing INodeType interface
    • sentry-sdk-entry.ts - Re-exports @sentry/node SDK for Vite bundling (excluded from TypeScript compilation)
    • sentry-sdk.bundle.js - Bundled Sentry SDK (generated by Vite, gitignored)
    • sentry.svg - Light mode Sentry logo icon
    • sentry.dark.svg - Dark mode Sentry logo icon
  • credentials/ - Contains credential type definitions (currently empty as DSN is provided as a node parameter)
  • dist/ - Build output directory (generated by TypeScript compiler)
  • scripts/ - Build and release scripts
  • vite.config.ts - Vite configuration for bundling the Sentry SDK
  • .github/workflows/ - CI/CD workflows for testing and releasing

Key Technical Details

Node Development

  • Nodes must implement the INodeType interface from n8n-workflow
  • Each node requires a description property with metadata and a execute method for runtime logic
  • Node files are registered in package.json under n8n.nodes
  • Icons are provided as light/dark SVG pairs

TypeScript Configuration

  • Strict mode enabled with TypeScript target ES2019
  • CommonJS module system
  • Output to dist/ directory
  • Source maps and declarations generated

Code Style

  • Uses tabs (width 2) for indentation
  • Single quotes for strings
  • Semicolons required
  • Trailing commas in multi-line structures
  • Print width: 100 characters
  • ESLint configuration imported from @n8n/node-cli/eslint with custom ignores
  • Strict mode disabled in package.json to allow custom ESLint configuration for bundled files

Error Handling Pattern

  • Wrap operations in try-catch blocks
  • Use NodeOperationError for node-specific errors
  • Support continueOnFail() mode for error recovery
  • Include itemIndex in error context for debugging

Sentry Node Implementation

Dependencies

  • @sentry/node (v10.21.0+) - Official Sentry SDK for Node.js (devDependency, bundled at build time)
  • vite (v5.0.0+) - Used to bundle the Sentry SDK into a local file

SDK Bundling

To comply with n8n Cloud's linting restrictions on external dependencies, this package uses Vite to bundle the @sentry/node SDK at build time:

  • Why: n8n Cloud's @n8n/community-nodes/no-restricted-imports rule prevents direct imports of external packages
  • How: Vite bundles the SDK from sentry-sdk-entry.ts into sentry-sdk.bundle.js (CommonJS format)
  • When: The bundling happens automatically during npm run build before TypeScript compilation
  • Result: The node imports from the bundled file instead of the npm package, passing linting while maintaining full SDK functionality

Node Configuration

The Sentry node has the following parameters:

  1. DSN (string, required)
    • Sentry Data Source Name
    • Format: https://examplePublicKey@o0.ingest.sentry.io/0
    • Not stored as a credential since it's not a secret
  2. Message (string, required)
    • The log message content to send to Sentry
  3. Level (options, default: info)
    • Log severity level
    • Options: trace, debug, info, warn, error, fatal
    • Alphabetically sorted per n8n linting requirements
  4. Attributes (fixedCollection, optional)
    • Dynamic key-value pairs for log metadata
    • Users can add multiple attributes
    • Each attribute has a key and value field

Implementation Details

  • Initialization: Sentry SDK is initialized per execution with SentrySDK.init({ dsn, enableLogs: true })
  • Logging: Uses SentrySDK.logger[level](message, attributes) based on Sentry's structured logs API
  • Flushing: Calls SentrySDK.flush() after logging to ensure delivery
  • Data Flow: Returns input items enriched with sentryLog metadata (message, level, attributes, dsn, timestamp)
  • Import: Imports from ./sentry-sdk.bundle.js (the bundled SDK) instead of directly from @sentry/node

Testing Locally

# Development mode with hot-reload
npm run dev

# Or link to existing n8n installation
npm link
# Then in your n8n directory:
npm link @sentry/n8n-nodes-sentry

Version Management

We use craft to release in a Github workflow

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.