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

Infinite redirect loop if no servers can be found #56

Closed
marckohlbrugge opened this issue Feb 1, 2024 · 4 comments · Fixed by #68
Closed

Infinite redirect loop if no servers can be found #56

marckohlbrugge opened this issue Feb 1, 2024 · 4 comments · Fixed by #68
Assignees

Comments

@marckohlbrugge
Copy link

marckohlbrugge commented Feb 1, 2024

Problem

When MissionControl::Jobs::Current.application.servers is empty, the application gets stuck in an infinite redirect loop. This might happen when config.active_job.queue_adapter is not set.

Why it happens

Visiting http://localhost:3000/jobs will redirect to http://localhost:3000/jobs/ which redirects to itself and so on.

This happens when there are zero MissionControl::Jobs::Current.application.servers which raises a MissionControl::Jobs::Errors::ResourceNotFound which in turn redirects to root_url which calls queues#index which starts the redirect loop again.

Proposed solution

If no servers are found, do not redirect to root_url but show an error message. Optional: If config.active_job.queue_adapter is set, suggest the user to set it as that's likely the cause for no servers being found.

@rosa
Copy link
Member

rosa commented Feb 3, 2024

Oops, redirecting on ResourceNotFound was a late addition and I missed this case, thanks for letting me know with this very carefully written issue 🙏 Thank you also for the proposed solution!

@rosa
Copy link
Member

rosa commented Feb 14, 2024

I went with something else instead: just set the async adapter like Active Job does, when there's no adapter configured, and let that bubble up as an IncompatibleAdapter error, until https://github.com/basecamp/mission_control-jobs/issues/32 is done 😅

@rosa rosa closed this as completed in #68 Feb 14, 2024
@laran
Copy link

laran commented Feb 15, 2024

+1

@kidandcat
Copy link

kidandcat commented Feb 18, 2024

This is happening to me with Solid Queue too
config.active_job.queue_adapter = :solid_queue

My bad, I had not enabled Solid Queue in my dev environment. Following the README steps, it works seamlessly when using Solid Queue.

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

Successfully merging a pull request may close this issue.

4 participants