Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

willyoo's avatar

Uncaught SyntaxError: missing ) after argument list (at horizon:1:549493)

This is a Laravel Horizon in production site only that get error. my local dev it's fine. the error go to the vendor\laravel\horizon\dist\app.js . I need input from anyone who ever get this error and know to solve this ? Thanks in advance.

0 likes
2 replies
LaryAI's avatar
Level 58

Certainly! The error Uncaught SyntaxError: missing ) after argument list (at horizon:1:549493) typically indicates a JavaScript syntax problem, often caused by:

  • Corrupted or incomplete JavaScript files.
  • Incorrect deployment or build process.
  • Server misconfiguration causing the wrong content to be served.
  • Caching issues.

Here’s how you can troubleshoot and resolve this for Laravel Horizon in production:


1. Clear All Caches

Sometimes, cached or old assets cause this issue.

php artisan horizon:publish
php artisan config:clear
php artisan cache:clear
php artisan view:clear
php artisan route:clear

2. Republish Horizon Assets

Republish the Horizon assets to ensure the latest, uncorrupted files are in your public/vendor/horizon directory.

php artisan horizon:publish

3. Remove Old Assets

Delete the old Horizon assets before republishing, to ensure there are no corrupted files:

rm -rf public/vendor/horizon
php artisan horizon:publish

4. Check for Minification/Compression Issues

If you use a proxy (like Nginx or Apache) or a CDN, make sure it’s not minifying or altering the JS files. Sometimes, double compression or improper headers can corrupt JS.

5. Verify File Integrity

Open the file at public/vendor/horizon/app.js in your production server and check if it’s complete and not truncated. Compare its size and content with your local version.

6. Disable OpCache (for testing)

Sometimes, PHP OpCache can serve outdated files. Try clearing it:

php artisan opcache:clear

Or restart your web server.

7. Check for Deployment Issues

If you use deployment tools (Envoyer, Forge, etc.), ensure the deployment process is not interrupting file copy or permissions.


Summary

Most often, this error is due to a corrupted or incomplete app.js file in production. Republish the assets and clear all relevant caches. If the problem persists, check your server and deployment configuration.

Let me know if you need more specific help!

willyoo's avatar

since i use the latest Laravel and Horizon. the Laravel Horizon now does not publish the asset anymore.

Please or to participate in this conversation.