Setry does not capture event if inited programatically with Spring boot starter
See original GitHub issueHi 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://examplePublicKey@o0.ingest.sentry.io/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?
Issue Analytics
- State:
- Created 3 years ago
- Comments:7
Top Results From Across the Web
Troubleshooting Spring Boot applications with Sentry
Sentry Spring Boot Starter provides an auto-configuration for Logback - once it finds out that both logback and sentry-logback are in the ...
Read more >Sentry.io doesn't capture errors when Spring Boot running in ...
When you add Sentry's SDK to your app and configure it with the correct DSN , your app will connect to Sentry to...
Read more >Bootiful Exception Reporting with Sentry & Spring Boot
0:00 - The problem with error reporting0:54 - What is Sentry ? 3:49 - Sentry + Spring Boot Integration7:11 - Attaching user information...
Read more >[VDZ22] Troubleshooting Spring Boot applications with Sentry ...
No matter how clean our code is, how good our tests are, how well our infrastructure scales - one day, eventually something will...
Read more >Sentry with Spring Boot - 42talents
Adding Sentry to your Spring Boot applications is done in two steps: Add sentry-spring-boot-starter as a dependency to pom.xml . Since it's not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You cannot default to
null
this way (read more: https://github.com/spring-projects/spring-framework/issues/19986).Sentry accepts empty string as a DSN - this will disable Sentry integration:
Spring integration is configured only if property
sentry.dsn
is present. If you initialize Sentry manually, you can send Sentry events created manually but you the whole servlet infrastructure to capture exceptions to Sentry isn’t there.Great! 💪