Question for anyone on here: Has anyone integrated...
# kobweb
r
Question for anyone on here: Has anyone integrated Sentry/Glitchtip? I was just able to do it (and exceptions are getting reported), but the main thing I haven't been able to do is get the kotlin source maps working.
d
Through Kobweb? I thought running
jsBrowserDevelopmentRun
(which
kobweb run
calls) was all you needed to do?
r
No--you have to upload the source maps.
Unless I'm missing something.
d
Maybe I should look into what Sentry/Glitchtip are :)
r
I see. Sentry is basically like Firebase Crashlytics. I works super-well for browser apps.
Glitchtip performs the same function, but it's easier to self-host.
d
Ah I see. So basically when you build your code, you want to do an additional gradle step to upload those source maps?
r
That's correct.
d
Production only yeah?
r
Correct.
Within the browser itself, the console links to the appropriate kotlin code--which is handy.
It doesn't seem like much of a stretch to get that to work when uploading stacktraces.
Unless things work differently than I think.
d
Are you having trouble finding the task that generates the source maps?
r
(which is entirely possible)
d
(I assume the webpack task)
r
I was reading through the kobweb application plugin code to see if I could find that.
d
Do this
d
In your projectn site, run
../gradlew kobwebStart --dry-run
That will show you all the dependency tasks
You can then locate the source maps in your build dir
Then just run the raw Gradle commands until the source maps appear
Then you have a Gradle task you can at least hook onto/depend on at which point you can locate and upload those files to sentry or whatever
https://kobweb.varabyte.com/docs/getting-started/kobweb-project#gradle-commands may help and make sure you pass in gradle args that indicate a production run and not a dev run
r
until the source maps appear
I'm not sure I know what to check for.
d
What source map is the browser linking to?
Actually I think maybe we copy it on export now that I'm recalling it
r
Is it this?
s
aren't js maps included per default in the export?
d
We drop a source map under .kobweb/site somewhere (I think the location depends on fullstack vs static)
r
Ah--it's .kobweb/site/site.js/site.js.map
d
So you can basically grab the export task by name in your build script, configure it, and in a
doLast
find the file and upload it
r
Cool. I've almost got it working, but the reason it's not working is not because of anything related to kobweb.
K 1