Skip to content

Setry does not capture event if inited programatically with Spring boot starter #1339

Closed
@JanCizmar

Description

@JanCizmar

Hi there,

I am building and app, where I need to configure both backend and frontend DSNs in my properties.yaml such as

tolgee:
  sentry:
    enabled: true
    server-dsn: ...
    client-dsn: ...

That's why i don't want to use other configuration options such as "sentry.dsn" option.

I would like to init sentry in code as documentation says: https://docs.sentry.io/platforms/java/guides/spring-boot/configuration/

import io.sentry.Sentry;

Sentry.init(options -> {
  options.setDsn("https://[email protected]/0");
});

But when I do so, It doesn't capture anything. So maybe the documentation is wrong or I am doing something wrong.
I am calling the init method in my main Application class constructor.

If i provide "sentry.dsn", it works properly, so as a workaround I do this in my application.yaml

sentry:
  dsn: ${tolgee.sentry.server-dsn}

Should I call the Sentry.init method elsewhere? Or is there another reason why it doesn't work?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions