Skip to content

ghostd/spring-boot-source-maps-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a demo project showing how to serve static resources with Spring Boot. The URLs of the resources are versioned (either with a fixed version, either with a MD5 hash of the file content). The application wraps the Angular exception handler and send the crash informations to the server.

Technical dependencies

How to play with it

Run the application

All you need is a JVM and Maven. Then, in the project directory:

mvn package
cd war
mvn spring-boot:run

Crash it

Open your favorite browser and go to http://localhost:8080. You should get a page with a "Crash me!" button. Click it to crash the application.

Now, check your JavaScript console, you should have something like that:

Error: y is not defined
r.crash@http://localhost:8080/v1.2.3/js/app.min.js:1:605
anonymous/fn@http://localhost:8080/js/libs.min-15d5de83249c076bb2be185454f98af6.js line 6 > Function:2:203
Go[t]</<.compile/</</i@http://localhost:8080/js/libs.min-15d5de83249c076bb2be185454f98af6.js:7:6269
gn/this.$get</d.prototype.$eval@http://localhost:8080/js/libs.min-15d5de83249c076bb2be185454f98af6.js:5:5877
gn/this.$get</d.prototype.$apply@http://localhost:8080/js/libs.min-15d5de83249c076bb2be185454f98af6.js:5:6106
Go[t]</<.compile/</<@http://localhost:8080/js/libs.min-15d5de83249c076bb2be185454f98af6.js:7:6319
Ge@http://localhost:8080/js/libs.min-15d5de83249c076bb2be185454f98af6.js:3:16504
We/n@http://localhost:8080/js/libs.min-15d5de83249c076bb2be185454f98af6.js:3:16453
 undefined

Check your server logs, you should get something like that:

Client JS exception ReferenceError: y is not defined
 with user agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0 Iceweasel/42.0
 with data: {some=app data}
 with stack:
  r.crash@app.js:52:17
  anonymous/fn@http://localhost:8080/js/libs.min-15d5de83249c076bb2be185454f98af6.jsline6>Function:2:203
  Go[t]</<.compile/</</i@angular.js:23613:17
  gn/this.$get</d.prototype.$eval@angular.js:16052:16
  gn/this.$get</d.prototype.$apply@angular.js:16152:20
  Go[t]</<.compile/</<@angular.js:23618:17
  Ge@angular.js:3346:3
  We/n@angular.js:3334:9

Compare the line numbers of the app.js and app.min.js files, they are not the same. In your server logs, you now have an helpful stack :-)

License

MIT

About

Demo project with Spring Boot and a crash reporter reading the source maps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published