PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Blocks

    Design blocks for your website

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

Question By
Solved

Error 500 only sometimes

Solved
cassiolacerda

Feb 20th, 2023 07:16 AM

Hi, I'm having an issue with my laravel app on digital ocean.

When I visit my website, sometimes the page loads normally and sometimes I get a 500 error.

Why does error 500 only appear sometimes?

You can enter this link to test: https://easypost.tech/

You will see that sometimes the website loads and sometimes a 500 error appears.

bobbyiliev

Feb 20th, 2023 01:40 PM

Hi there,

I would recommend checking your Laravel log at storage/logs/laravel.log for more information on what the actual error is.

The 500 error is displayed when Laravel ENV is set to production so that the actual error is hidden. But in the log you should be able to see the actual error that is causing the problem.

Feel free to share the actual error here.

Report
1
cassiolacerda

Feb 21st, 2023 07:50 AM

There are no errors in my laravel.log

bobbyiliev

Feb 21st, 2023 08:46 AM

Best Answer

What you could do is temporarily enable debug mode so you could see the error displayed on the site directly. You can do that by changing the APP_ENV from prod to local so you could take a screenshot of the error and then rever the change.

I have a hunch that the problem is with sessions, if you've deployed your app on the DigitalOcean App Platform, and if you've selected a plan with multiple containers, then you would also need to setup Redis so that the containers could share the sessions. You can add a Redis cluster to your setup and then define the standard Redis details as ENV variables.

Alternatively, you could scale down to just a single container rather than using multiple ones.

Let me know how it goes!

Best,

Bobby

Report
1
cassiolacerda

Feb 25th, 2023 03:54 PM

Thanks, Bobby!

bobbyiliev

Feb 26th, 2023 03:34 AM

No problem at all! Happy to help!