Skip to content

[FEATURE] Add option to override default apiUrl and authHeader #41

Open
@capybarahero

Description

🚀 Feature request

Is your feature request related to a problem?

Hi all, thanks for maintaining this lib!

We use today self-hosted Glitchtip, and we are considering migrating from @sentry/browser to micro-sentry on the frontend. However, we noticed that you follow a very specific apiUrl structure and have a pre-defined authHeader, so that custom DSNs won't match this pattern and will fail.

Describe the solution you'd like

Add option to override the default apiUrl and authHeader.

This would also be beneficial for people using tunnel.

Thanks!

Additional context

Here is the snippet I refer to:

  constructor(options: SentryClientOptions) {
    if (options && options.dsn) {
      const searched = DSN_REGEXP.exec(options.dsn);
      const dsn = searched ? searched.slice(1) : [];
      const pathWithProjectId = dsn[5].split('/');
      const path = pathWithProjectId.slice(0, -1).join('/');

      this.apiUrl =
        dsn[0] +
        '://' +
        dsn[3] +
        (dsn[4] ? ':' + dsn[4] : '') +
        (path ? '/' + path : '') +
        '/api/' +
        pathWithProjectId.pop() +
        '/store/';

      this.authHeader =
        'Sentry sentry_version=7,sentry_key=' +
        dsn[1] +
        (dsn[2] ? ',sentry_secret=' + dsn[2] : '');
    }

Source: https://github.com/taiga-family/micro-sentry/blob/main/libs/core/src/lib/service/micro-sentry-client.ts

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions