
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
sentry-lightweight-client
Advanced tools
Легковесный клиент для отправки ошибок в Sentry с поддержкой очередей, контекста и минимальной зависимости от SDK.
Легковесный клиент для отправки ошибок в Sentry с поддержкой очередей, контекста и минимальной зависимости от SDK.
pnpm add sentry-lightweight-client
# или
npm install sentry-lightweight-client
# или
yarn add sentry-lightweight-client
import { Client } from 'sentry-lightweight-client'
const sentryClient = new Client({
dsn: 'https://<PUBLIC_KEY>@sentry.io/<PROJECT_ID>',
})
sentryClient.capture(new Error('Something went wrong'))
sentryClient.capture('String-based error')
sentryClient.capture(new Error('Something went wrong'), {
extra: {
userId: '123',
feature: 'checkout',
},
tags: {
env: 'production',
},
fingerprint: ['custom-fingerprint'],
})
Библиотека может использоваться как реализация Instrumentation.onRequestError
из next/dist/server/instrumentation/types
:
import type { InstrumentationOnRequestError } from 'next/dist/server/instrumentation/types'
import { Client } from 'sentry-lightweight-client'
const client = new Client({ dsn: process.env.SENTRY_DSN! })
export const onRequestError: InstrumentationOnRequestError = (
error,
request,
context,
) => {
client.capture(error, {
extra: {
url: request.path,
method: request.method,
headers: request.headers,
...context,
},
})
}
Client
: основной класс, отвечающий за инициализацию и отправку ошибок.HttpClient
: low-level HTTP POST-обертка.InformationBuilder
: собирает payload ошибки в формат, понятный Sentry.Queue
: очередь для последовательной отправки событий (например, при загрузке/нагрузке).Если DSN передан в неправильном формате — клиент выбросит исключение:
Invalid Sentry DSN - your_dsn_value. Check is dsn format valid
Ожидаемый формат:
https://<PUBLIC_KEY>@sentry.io/<PROJECT_ID>
import { Client } from 'sentry-lightweight-client'
import { getEnvironment } from '@utils/guards/environment'
import { isString } from '@utils/guards/types'
import type { InstrumentationOnRequestError } from 'next/dist/server/instrumentation/types'
type RequestServerErrorParameters = Parameters<InstrumentationOnRequestError>
class Service {
private readonly _client = new Client({ dsn: getEnvironment('SENTRY_DSN') })
public capture(error: string | Error) {
this._client.capture(error)
}
public captureServerHandlerError(
error: RequestServerErrorParameters[0],
request: RequestServerErrorParameters[1],
context: RequestServerErrorParameters[2],
) {
if (isString(error) || error instanceof Error) {
this._client.capture(error, {
extra: {
url: request.path,
method: request.method,
headers: request.headers,
...context,
},
})
}
}
}
export const errorService = new Service()
extra
, tags
, fingerprint
MIT
FAQs
Легковесный клиент для отправки ошибок в Sentry с поддержкой очередей, контекста и минимальной зависимости от SDK.
The npm package sentry-lightweight-client receives a total of 25 weekly downloads. As such, sentry-lightweight-client popularity was classified as not popular.
We found that sentry-lightweight-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.