getsentry / getsentry/sentry-javascript

Feature: simplify microfrontend project provisioning and DSN routing

Abierto
#21,944 4 comentarios 1 reacción 1 asignado Reclamado por @chargome Ver en GitHub
Browser Feature javascript
Lenguaje dominante
TypeScript
Estrellas
8.7k
Forks
1.8k
Merge medio
1 d 17 h
PR fusionados (30 d)
515

Descripción

The current microfrontend setup requires manually creating a Sentry project per microfrontend and hardcoding its DSN into the bundler plugin config. For organizations with hundreds of microfrontends this doesn't scale — provisioning and wiring up each project is a significant operational burden.

**Current behavior**

- One Sentry project must be created per microfrontend
- Each DSN must be manually retrieved and embedded via `moduleMetadata` in the bundler plugin
- `makeMultiplexedTransport` handles runtime routing, but project creation is entirely out-of-band

**Gap**

The [Sentry Exporter for OpenTelemetry](https://docs.sentry.io/concepts/otlp/forwarding/pipelines/sentry-exporter/) already solves this at the collector layer with `auto_create_projects` + `routing.project_from_attribute`. There's no equivalent DX for browser microfrontends — the routing primitive exists (`makeMultiplexedTransport`) but project provisioning is a manual step that doesn't scale.

**Options**

- Auto-provision projects from the bundler plugin at build time using a server-side auth token (matches the OTel exporter model — token stays in CI, not the browser)
- Support a named-project routing mode where DSNs are resolved at build time from a project slug, eliminating the need to manually look up and embed DSNs
- A first-party CLI/script to bulk-create projects from a list and emit a DSN map for bundler consumption

**Workaround (available today)**

Projects can be bulk-created server-side and DSNs injected at build time using existing primitives:

1. **Sentry API** — `POST /api/0/teams/{org}/{team}/projects/` ([docs](https://docs.sentry.io/api/projects/create-a-new-project/)) with `project:write` scope; loop over your microfrontend list in CI to create projects and capture returned DSNs
2. **Terraform** — use the [`jianyuan/sentry`](https://registry.terraform.io/providers/jianyuan/sentry/latest/docs) or [`labd/sentry`](https://registry.terraform.io/providers/labd/sentry/latest/docs) provider with `sentry_project` + `for_each`; outputs the DSN as a resource attribute
3. Inject the resulting DSNs at build time via `moduleMetadata` in your bundler plugin config — the existing `makeMultiplexedTransport` setup ([docs](https://docs.sentry.io/platforms/javascript/best-practices/micro-frontends/)) handles runtime routing from there

The workaround is functional but requires owning the provisioning layer separately. The feature request is to make this a first-class, low-friction part of the microfrontend setup.

--

[View Junior Session in Sentry](https://sentry.sentry.io/explore/conversations/slack%3AD0AP8R5C3UH%3A1783018228.982239/?project=4510944073809921)

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.