New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

sssentry

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sssentry

Just a small lib which simplifies adding Sentry to Workers

latest
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

SSSentry

Very quick setup for Sentry inside of Cloudflare Workers using ToucanJS.

Install

You will want to install this package and make sure it's bundled when your Worker is uploaded. Wrangler 2 will by default use esbuild and bundle for you.

npm i --save sssentry

Usage

Option 1

JavaScript (example)

import { sentryFetch } from 'sssentry';

export default {
  fetch(req, env, ctx) {
    return sentryFetch(req, env, ctx, { dsn: 'https://project@ingest.sentry.io/1' }, this.handleRequest);
  },

  async handleRequest(req, env) {
    // Actual logic
    // env.SENTRY.setUser('abc123');
    return new Response('Blobs are cool!');
  }
}

TypeScript (example)

import { sentryFetch, Toucan } from 'sssentry';

interface Env {
  KV: KVNamespace;
  SENTRY: Toucan;
}

export default {
  fetch(req: Request, env: Env, ctx: ExecutionContext) {
    return sentryFetch(req, env, ctx, { dsn: 'https://project@ingest.sentry.io/1'  }, this.handleRequest)
  },

  async handleRequest(req: Request, env: Env): Promise<Response> {
    // Actual logic
    // env.SENTRY.setUser('abc123');
    return new Response('Blobs are cool!');
  }
}

Option 2

JavaScript (example)

import { sentryFetch, setup } from 'sssentry';

setup({ dsn: 'https://project@ingest.sentry.io/1' }, handleRequest);

async function handleRequest(req, env) {
  // Actual logic
  // env.SENTRY.setUser('abc123');
  return new Response('Blobs are cool!');
}

export default { fetch: sentryFetch }

TypeScript (example)

import { sentryFetch, setup, Toucan } from 'sssentry';

interface Env {
  KV: KVNamespace;
  SENTRY: Toucan;
}

setup({ dsn: 'https://project@ingest.sentry.io/1' }, handleRequest);

async function handleRequest(req: Request, env: Env): Promise<Response> {
  // Actual logic
  // env.SENTRY.setUser('abc123');
  return new Response('Blobs are cool!');
}

export default { fetch: sentryFetch }

FAQs

Package last updated on 25 Nov 2022

Did you know?

Socket

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.

Install

Related posts