bastywebb's avatar

Breeze + Next.js + Sail - issue with localhost:8000

Hey guys,

I'm trying to follow the setup for breeze/next.js shown here: github.com/laravel/breeze-next

I'm running Docker and Sail.

After completing everything and doing yarn run dev, the frontend works fine on:

localhost:3000

But I get connection refused on:

localhost:8000

So Next.js can't communicate with the Laravel API

I've tried disabling my firewall on windows, and I don't think I have one on Ubuntu (for sail). I've scoured the internet and can't find any solution, which normally means I'm missing something obvious. Any suggestions would be very much appreciated.

Thanks!

0 likes
2 replies
Niush's avatar

Doesn't by default Laravel Sail simply run in localhost without any port (port 80)? Have you tried that?

You can also change port to 8000 inside docker-composer if you want.

1 like
bastywebb's avatar

You were right, I needed to use plain localhost. The reason I missed that is that I was getting a 500 error on plain localhost. This was because I needed to generate a key (I see now that there are helpful error logs in storage/logs/laravel.log).

To fix the 500 error I needed to do:

sail artisan key:generate

And then:

sail artisan config:cache

Thanks so much for your help, it's also good to know I can change the ports inside docker.

Please or to participate in this conversation.