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

Kombee's avatar
Level 7

Livewire Error : Unexpected token '<' in console

We've set up the Livewire admin panel, and it works perfectly on our local environment. However, after deploying the code on our UAT server through AWS-Vapor, we're encountering an error. The update method is redirecting to the domain itself and the Windows Console is showing the below error.

Uncaught (in promise) SyntaxError: Unexpected token '<', "

at sendRequest (livewire.js?id=cc800bf4:4321:52)
at async RequestPool.send (livewire.js?id=cc800bf4:4041:7)

Here are some things I've tried to fix the issue:

I attempted to remove and re-add the doctype in the master blade file, but it didn’t resolve the issue. I also noticed that on inspecting the login page, it initially displays two blank lines, which might be causing the problem, but I couldn't trace the root cause in our source code.

I removed public/vendor from the .gitignore, re-published all Livewire assets, and committed them, but this didn’t help either.

We have added a reCAPTCHA on the login page, I temporarily disabled reCAPTCHA to check if that was causing the issue, but there was no improvement.

0 likes
4 replies
manishchauhan's avatar

The error message Unexpected token '<' in the console often indicates that your application is returning an HTML response (like a 404 or 500 error page) instead of the expected JSON or JavaScript, particularly when working with Livewire in Laravel.

Ensure you have the CSRF token properly configured in your Blade template

Kombee's avatar
Level 7

@manishchauhan The CSRF token is properly configured and working fine with the local system. The livewire update method redirects to the domain itself.

Snapey's avatar

Likely, one of your php files has a < before the opening php tag, eg

<<?php

or 

<
<?php

for example. This could be in any file that gets booted as part of the request cycle.

Before chasing this as a potential solution, look in detail at the network request data and see if it is prefixed by this character

Please or to participate in this conversation.