WHAT 500 error?
Livewire.js 500 error in production
I have a Livewire project which works on my local environment. However, when I set up the application on the production server (Nginx) I am getting a 500 error for livewire.js.
I have found a topic discussing this on: https://github.com/livewire/livewire/issues/242 using RunCloud service I've tried solutions from this but still can't resolve the issue.
Here are things that I've tried:
Trying to run: "php artisan vendor:publish --force --tag=livewire:assets"
When I do this command I only get this message with no changes:
"No publishable resources for tag [laravel-assets]."
Running: "php artisan vendor:publish" then setting:
'asset_url' => 'mydomain.com'. when I do this the path turns into something like: 'mydomain.com/mydomain.com?id=12jk1212 which still has the same error.
I've also tried stuff like '/public' (in RunCloud I need to set the root directory of the project to '/public' on installation) but I get the same error.
Setting an Nginx config directive to:
location ~* \.(jpg|jpeg|gif|png|webp|svg|woff|woff2|ttf|css|js|ico|xml)$ {
try_files $uri /index.php?$query_string;
access_log off;
log_not_found off;
expires 14d;
}
The error turns to this when I use this config on Nginx:
Refused to execute script from 'https://mydomain.com/livewire/livewire.js?id=12jk1212' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
If I turn off MIME sniffing protection on RunCloud I get the following:
Uncaught SyntaxError: Unexpected token '<' (at livewire.js?id=12jk1212:1:1)
I'm unsure how to resolve this and my server knowledge is not great. It works on my local development setup (Laragon) so I'm assumming it might be something to do with RunCloud Nginx.
Please can anyone advise how to debug this further or a solution?
Thanks.
Please or to participate in this conversation.