Reputation: 11
I've been trying to setup Bugsnag on a new project since yesterday, but I can't seem to get it right.
This project is written in Kotlin, and I'm using the Spring Boot framework. I followed all the integration guide's steps (got my Bugsnag bean, with the right API key, configured the exception handler, etc).
So, I've been debugging my app, and the handler is called as it should, the call to bugsnag.notify
is effective too, I see it go to the deliver step and pass it successfully, but still, no error report show up on the Bugsnag web app.
I don't know how to debug it more than I already have.
Here are some relevant code samples :
// Application.kt
@Configuration
open class ApplicationConfiguration(private val config: Config) {
@Bean
open fun bugsnag(): Bugsnag = Bugsnag(config.bugsnag.key).apply { setReleaseStage(config.envName) }
}
Here's my handler
// BugsnagHandlerExceptionResolver.kt
@Component
class BugsnagHandlerExceptionResolver(private val bugsnag: Bugsnag) : HandlerExceptionResolver, Ordered {
override fun getOrder(): Int = 0
override fun resolveException(request: HttpServletRequest, response: HttpServletResponse, handler: Any?, ex: Exception?): ModelAndView? {
val report = bugsnag.buildReport(ex).apply {
request.headerNames.iterator().forEach {
addToTab("Headers", it, request.getHeaders(it).toList().joinToString())
}
context = request.method + " " + request.requestURL.toString()
}
bugsnag.notify(report)
bugsnag.notify(RuntimeException("pls work"))
return null
}
}
I tried to notify both a report & an exception, thinking one of the two should work... But none reaches its destination.
Upvotes: 1
Views: 457
Reputation: 11
Okay, so... I've been have trouble with it since yesterday, I decided to ask for some help here, so I refactored my config (to hide the API key from the code, so that I could actually copy/paste my code in here), and guess what. I refresh the bugsnag interface, and errors from 8 minutes ago showed up!
So basically, it resolved itself. I used to set the API key directly in the code, I only put it in my app's configuration for this post, and it seemed to have helped my case.
Anyway, it's resolved. I'm not sure it's thanks to this, but if someone else has troubles, try using your app's config...
Upvotes: 0