Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
fastify-sentry
Advanced tools
Readme
npm i fastify-sentry -s
const fastify = require("fastify")();
// Should be first declaration
fastify.register(
require("fastify-sentry"),
{
dsn: "https://00000000000000000000000000000000@sentry.io/0000000",
environment: "local",
errorHandler: (err, request, reply) => {
// You can specify a custom behavior depending on the context of "request", generate a unique identifier etc.
if (request.raw.url === "/") {
reply.send({
error: 500,
message: 'The main path "/" didn\'t work!',
payload: err
});
} else {
reply.send({
error: 501,
message: "Some other path failed!",
payload: err
});
}
}
},
err => {
if (err) throw err;
}
);
fastify.get("/", async (request, reply) => {
// Errors in async functions are automatically caught
throw new Error("Oops");
reply.send({ hello: "world" });
});
fastify.get("/other-path", (request, reply) => {
// On the other hand, you need to pass the Error object to "reply.send" for it to be logged as Fastify does not catch errors in synchronous functions!
reply.send(new Error("I did it again!"));
});
This plugin adds the Sentry SDK error handler by using fastify.setErrorHandler
. This means that the Sentry SDK will only catch any errors thrown in routes with async
functions. In order to properly log errors thrown within synchronous functions, you need to pass the error object within reply.send
. It also adds certain metadata, namely the path
and the ip
parameters of req.raw
, to both the User
context and Tag
context of Sentry.
Option | Description |
---|---|
dsn | Required, the DSN specified by Sentry.io to properly log errors to. |
Licensed under GPLv3.
FAQs
A plugin for attaching the Sentry SDK error handling to Fastify
The npm package fastify-sentry receives a total of 156 weekly downloads. As such, fastify-sentry popularity was classified as not popular.
We found that fastify-sentry demonstrated a not healthy version release cadence and project activity because the last version was released 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.