Skip to content

Support async configuration for SentryModule #16573

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 {}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions