Skip to content

Support async configuration for SentryModuleΒ #16573

@noook

Description

@noook

Problem Statement

Is it possible to document whether it is feasible to initialize Sentry with dynamic configuration ? My configuration depends on environment variable and dynamically fetched configurations from remote sources.

I understand the instrument.ts file is meant to be called as early as possible to log application initialization errors, but I have healthchecks on my container that will tell me if the app started or not.

Solution Brainstorm

I would expect something similar to this

@Global()
@Module({
  imports: [EnvModule],
  providers: [
    {
      provide: SENTRY_CLIENT,
      useFactory: (envService: EnvService, supabaseClient: SupabaseClient): SentryClient => {
        return Sentry.init({
          // usage of envService and supabase client
        }}
      },
      inject: [EnvService, SupabaseClient],
    },
  ],
  exports: [SENTRY_CLIENT],
})
export class SentryModule {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions