3

I am building a simple website in Laravel 6. I used the built in Laravel artisan tools to create authentication routes and views.

After logging in, a user should be redirected to /home. However, every now and then Laravel will redirect to /js/popper.js.map

I have no idea why Laravel is doing this! I have scoured error logs, to no avail. I am using Bootstrap, but I never explicitly told Laravel to import or use Popper. I have no idea why it specifically wants to go this specific file?? I've had this problem for weeks.

Sometimes running php artisan config:cache and cache:clear help, but not always. Furthermore, it sometimes will happen on my remote server, or on local, but often not at the same time, making it very hard to debug.

I have declared the Auth routes with the built in Laravel Auth. Like so:

php artisan ui bootstrap

And in web.php: Auth::routes();

I expect logging in to redirect to /home, which then redirects to welcome/red (part of my software). Instead, it gets stuck at js/popper.js.mapand 404s. Logging in WORKS, and I can access authenticated content. But it's a bad user experience to get stuck in a 404 page for no reason.

Does anyone have any clue where Laravel is getting the idea to redirect to /js/popper.js.map? Thank you!!!!

Anand G
  • 3,130
  • 1
  • 22
  • 28
PBB
  • 31
  • 5
  • Are you using nginx or apache? post the config for that – Salim Djerbouh Oct 25 '19 at 19:37
  • I am using Apache, and have not modified the default apache2.conf except to include Phpmyadmin. – PBB Oct 25 '19 at 19:40
  • in the network console, as you are using your site see if there are any requests for `js/popper.js.map` at all ... also how is your `.htaccess` file setup? the only odd thing i could think of is laravel is handling the request for that js file and then saves that path as the 'intended' url as you are not authenticated, after login it tries to redirect you back to what you were trying to reach (intended url), the only guess i could see that being laravel's doing ... but that would still require some route to match against for `auth` middleware to be involved – lagbox Oct 25 '19 at 20:05
  • Popper is a dependency of Bootstrap, but this isn't normal behavior - I've never seen this happen, nor ever seen a report of such a thing happening, so it's likely to be something unique to your setup. Start with the output of `php artisan route:list`. – ceejayoz Oct 26 '19 at 01:45
  • So I _may_ have solved this. I installed Telescope and noticed `js/popper.js.map` was resulting in `302 error`. Some research in "bad routes 302" resulted in a StackOverflow post that recommended removing slashes. My routes looked like `Route::get('/about', PagesController@about');`. Changing to ` Route::get('about', PagesController@about');` seems to work for now. Will report back if I continue to have this problem. I would still like to know _why_, but for now it works...I appreciate your answers, thank you!!! – PBB Oct 29 '19 at 20:38
  • Scratch that, I think I've got it. This is nuts, and I can't believe I didn't figure this out sooner, but it only fails when the _developer console_ is open. I have my Chrome Devtools set to disable caching when it's open to make debugging JS and CSS easier. I was able to track this down by a "cache key missing" error in Telescope. I can't say that I fully understand what's happening behind the scenes here, but at least tracking down devtools as the source is a good start. – PBB Oct 30 '19 at 15:07
  • check this https://stackoverflow.com/questions/36051891/esri-failed-to-parse-source-map – oussama benounnas Feb 13 '20 at 23:00
  • 5 months later with a much better understanding of Laravel, I have a real solution. All I had to do was add .sourceMaps() to my webpack.mix.js, and no more popper error. I can't believe it took me this long... – PBB Apr 02 '20 at 14:04

1 Answers1

1

I’ve never had this issue. Maybe you could start with a simple controller and view? Without any assets and packages loaded? From that point add packages and assets one by one. You should find your bug. And did you write any tests? That should help a lot!

And I assume this popper.js file is loaded by a npm package? Maybe it helps to uninstall it?

Rolf
  • 599
  • 5
  • 12