Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed Jobs is loading forever with error "t.includes is not a function" #304

Closed
thiagolcks opened this issue Mar 6, 2018 · 13 comments · Fixed by #582
Closed

Failed Jobs is loading forever with error "t.includes is not a function" #304

thiagolcks opened this issue Mar 6, 2018 · 13 comments · Fixed by #582

Comments

@thiagolcks
Copy link

When trying to load the Failed Jobs in the browser console I'm getting the error: t.includes is not a function

Not sure if it's related but on the Dashboard, the status is "Inactive", but it seems to be working fine, the jobs are being processed. Trying to figure it out, it's working well on my localhost and was working well on the production server.

I'm using Horizon 1.2.2 and Laravel 5.5.35.

@thiagolcks thiagolcks changed the title Failed Jobs is loading forever Failed Jobs is loading forever with error "t.includes is not a function" Mar 6, 2018
@thiagolcks
Copy link
Author

Killing the horizon process using kill instead of horizon terminate fixed both problems. I don't know why, but it seems sometimes horizon terminate just doesn't work.

@thiagolcks
Copy link
Author

Now the server is Active but having the same issue on the Failed Jobs page.

@driesvints
Copy link
Member

This seems to be working fine for me. I think the only way to check what's going wrong if you could actually show us the app where you're having the problem.

@srottem
Copy link

srottem commented Feb 13, 2019

Can this be reopened? I'm also seeing the behavior, but in my case sometimes it's on the Recent Jobs list. The spinner is displayed for ages (several minutes) but will eventually show the list.

While th spinner is shown I can see the network calls to recent?starting_at=-1&limit=50 happening every second or so, but for the duration that the spinner is shown the following error is displayed in the console every second or so:

TypeError: t.includes is not a function
at a.jobBaseName (app.js:1)
at a.n [as jobBaseName] (app.js:1)
at app.js:1
at ae [as _l] (app.js:1)
at a.render (app.js:1)
at a.t._render (app.js:1)
at a.r (app.js:1)
at oi.get (app.js:1)
at oi.run (app.js:1)
at Et (app.js:1)

@driesvints
Copy link
Member

@srottem can you show us an example app which re-creates this problem? Perhaps some example requests with their payload, response & headers?

@driesvints driesvints reopened this Feb 14, 2019
@srottem
Copy link

srottem commented Feb 14, 2019

I'm afraid I can't provide an example app - no time to build one and the affected one is restricted access. I can, however provide a sample request. The attached is an HAR from Chrome while the spinner was displayed while attempting to view recent jobs. Note that I have anonymized it a little by replacing the company name with the word 'company', but other wise it's unchanged.
HAR.txt

@srottem
Copy link

srottem commented Feb 14, 2019

What's interesting is that although the HAR from Chrome shows the errors all of the requests receive a valid JSON response - see attached for a sample taken from one of the requests while the spinner was spinning.
response.txt

@fredrlx
Copy link

fredrlx commented Feb 20, 2019

Hi, not sure if this is related or not but I had the same issue with the Failed Jobs panel loading forever. There were exceptions filling up my Laravel log when browsing the Failed Jobs tab:

Malformed UTF-8 characters, possibly incorrectly encoded {"exception":"[object] (InvalidArgumentException(code: 0): MalformedUTF-8 characters, possibly incorrectly encoded at /releases/20190220163342/vendor/laravel/framework/src/Illuminate/Http/JsonResponse.php:75)

But the stack trace did not allow to see what code in Horizon triggered that. I had to clear the failed_jobs keys in redis to unlock the situation. This issue appeared after I indeed changed the encoding of some fields in one of my models that got queued for a process job, so maybe that's related to special characters in the payloads ?

@driesvints
Copy link
Member

Is this still a problem with the latest version?

@driesvints
Copy link
Member

Closing this issue because it's inactive, already solved, old or not relevant anymore. Feel free to reply if you're still experiencing this issue.

@andriihorpenko
Copy link

Still the same problem for me. Pushed the job on the queue and Horizon "died". This is very random and happens 1 out of 10 jobs. Very uncomfortable.

@joecampo
Copy link
Contributor

joecampo commented Apr 26, 2019

Hi there,

I've ran into this on a production server using 3.1.1. What I found after debugging in the console was that there were a couple of jobs that have all false values:

image

No idea how they got in there. The name field of the job also is false, so when the method jobBaseName is calling JavaScript's string.includes() on a boolean.

https://github.com/laravel/horizon/blob/3.0/resources/js/base.js#L60

How I fixed it:

In the RedisJobRepository getJobs method there is a check to make sure that the job is an array and the the id of the job isn't null. I also added a check to not

https://github.com/laravel/horizon/blob/3.0/src/Repositories/RedisJobRepository.php#L196

return is_array($job) && $job[0] !== null && $job[0] !== false;

(The only reason I didn't use empty() here is because "0" returns true for empty(). Not sure if jobs start at 0, I figured it'd be better to be explicit about it)

@driesvints Would you accept a PR to make sure the job's id isn't false (since we already check to make sure it isn't null?)

Kind of feels like a band-aid because I'm not sure how these false jobs got in there, but solves the problem since the id shouldn't ever be false anyways.

@driesvints driesvints reopened this Apr 26, 2019
@driesvints
Copy link
Member

Hey @joecampo, yes feel free. Make sure you add an extensive explanation to your PR like you did here to make sure the pr gets accepted. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants