Skip to content

node: Support no-code init via --import or --require and env variables #11997

@timfish

Description

@timfish

Problem Statement

@sentry/node already supports much of the basic configuration via environment variables. These are great because you can change often change settings without re-deploying your code. However, users are still required to create a JavaScript file to call Sentry.init().

Solution Brainstorm

If we add an init export (@sentry/node/init) that calls Sentry.init() users can then initialise Sentry and get all the auto-instrumentation magic without writing any code:

> SENTRY_DSN=https://examplePublicKey@o0.ingest.sentry.io/0 node --import=@sentry/node/init app.mjs

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions