@seungkyu/error-reporter
v0.0.10
Published
Send server errors to chat application
Readme
Error Reporter for NestJS
A TypeScript library for NestJS that sends error reports to messaging platforms like Slack.
When an error other than an HttpException occurs on the server, it is reported according to the configured settings.
Installation
npm install @seungkyu/error-reporterUsage
Synchronous configuration
@Module({
imports: [
ErrorReporterModule.forRoot({
type: 'slack',
webhookUrl: process.env.WEBHOOK_URL || '',
serverName: process.env.SERVER_NAME,
}),
],
})
export class AppModule {
}Asynchronous configuration
@Module({
imports: [
ErrorReporterModule.forRootAsync({
imports: [ConfigModule],
inject: [ConfigService],
useFactory: (configService: ConfigService) => ({
type: 'slack',
webhookUrl: configService.getOrThrow('WEBHOOK_URL'),
serverName: configService.getOrThrow('SERVER_NAME'),
}),
}),
],
})
export class ReporterModule {
}
Configuration
slack, discord, google-chat
| Option | Type | Required | Default | Description | |------------|-----------------------------------|----------|----------------|--------------------------------------| | type | 'slack', 'discord', 'google-chat' | ✅ | - | type of messenger | | webhookUrl | string | ✅ | - | Slack webhook URL to send error logs | | serverName | string | ❌ | unknown server | Identifier for the server |
github
| Option | Type | Required | Default | Description | |-------------|----------|----------|----------------|----------------------------------------------| | type | 'github' | ✅ | - | type of messenger | | githubToken | string | ✅ | - | GitHub personal access token | | owner | string | ✅ | - | Repository owner (user or organization) | | repository | string | ✅ | - | Repository name where issues will be created | | serverName | string | ❌ | unknown server | Identifier for the server |
❗Warning
If an invalid or unauthorized token is provided, the application will fail to start.
The server will also fail to start if any of the required GitHub configuration values are missing or incorrect, including:
Example
slack

discord

google-chat

github

Contact
- Email: [email protected]
