Sometimes In Production | Livewire JSON parse error: Unexpected non-whitespace character at position
Environment:
Intermittent JavaScript errors occur when performing any action that uses JS in the admin panel (e.g., login attempts). The error appears randomly and makes the functionality unusable. Restarting the Docker container temporarily fixes the issue.
Error Details:
Uncaught (in promise) SyntaxError: Unexpected non-whitespace character after JSON at position 2408
at JSON.parse (...)
at sendRequest (livewire.js:4340)
at async RequestPool.send (livewire.js:4060)
docker-compose.yml
version: '3.8'
services:
# PHP-FPM Application
app:
build:
context: .
dockerfile: Dockerfile
container_name: test_filament_app
restart: unless-stopped
working_dir: /var/www/html
volumes:
test_filament_network:
driver: bridge
- Laravel 12 + Filament v3
- Production server
Intermittent JavaScript errors occur when performing any action that uses JS in the admin panel (e.g., login attempts). The error appears randomly and makes the functionality unusable. Restarting the Docker container temporarily fixes the issue.
Error Details:
Uncaught (in promise) SyntaxError: Unexpected non-whitespace character after JSON at position 2408
at JSON.parse (...)
at sendRequest (livewire.js:4340)
at async RequestPool.send (livewire.js:4060)
docker-compose.yml
version: '3.8'
services:
# PHP-FPM Application
app:
build:
context: .
dockerfile: Dockerfile
container_name: test_filament_app
restart: unless-stopped
working_dir: /var/www/html
volumes:
- ./:/var/www/html:cached
env_file: - .env
networks: - test_filament_network
ports: - ${PHP_PORT}:9000# Nginx Web Servernginx:image: nginx:alpinecontainer_name: test_filament_nginxrestart: unless-stoppedports:
- ${NGINX_PORT}:80
env_file: - .env
volumes: - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf
- ./:/var/www/html
depends_on: - app
networks: - test_filament_network
test_filament_network:
driver: bridge
