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

Dangerous query method (method whose arguments are used as raw SQL) called with non-attribute argument(s) #1024

Closed
MarkSiemers-msr opened this issue May 21, 2024 · 2 comments
Labels

Comments

@MarkSiemers-msr
Copy link

I'm not sure what may be the issue with our setup but I cannot avoid this error when trying to run a maintenance task.

We have been using a fork both of this gem and the job-iteration gem to avoid this error, but recently (perhaps due to an rails/activejob update) things stopped working with the validations, and we're now trying to move back to the official release of this gem, but this issue has come back up.

An example task that fails 100% of the time:

module Maintenance
  class RefreshAppMostRecentContractDetailsTask < MaintenanceTasks::Task
    def collection
      App.all
    end

    def process(app)
      app.refresh_most_recent_contract_details
    end
  end
end

It looks very similar to what is show in the README, there doesn't seem to be anything left to take out (it used to have a count method and a join on the App.all relation)

Previously, the fix that worked for us was this one: Shopify/job-iteration#226

We have relied on this tooling quite heavily so we're motivated to find a fix. Perhaps something is wrong on our end with a configuration or some other dependency.

This is what we have for listed dependencies (running bundle exec gem dependency maintenance_tasks and job-iteration):

Gem maintenance_tasks-2.7.0
  actionpack (>= 6.0)
  activejob (>= 6.0)
  activerecord (>= 6.0)
  job-iteration (>= 1.3.6)
  railties (>= 6.0)
  zeitwerk (>= 2.6.2)

Gem job-iteration-1.4.1
  activejob (>= 5.2)
  activerecord (>= 0, development)

# And the installed versions
actionpack (7.1.3.3)
activejob (7.1.3.3)
activerecord (7.1.3.3)
job-iteration (1.4.1)
railties (7.1.3.3)
zeitwerk (2.6.14)

maintenance_tasks (2.7.0)
job-iteration (1.4.1)

Any help or guidance is appreciated here. We have several dozen maintenance tasks and they all have this error when attempting to run them with the official release of the gem, and they all worked using the fork in the PR referenced above.

If there is a different configuration setting, or if there isn't full support for certain databases/versions, I've run out the the places I know to look and the trial and error I can think to run.

@MarkSiemers-msr
Copy link
Author

For some more context, here's screenshots of the task running successfully (on the previously used fork) and unsuccessfully (on the official gem release)

Previous successful run
Screenshot 2024-05-21 at 1 40 28 PM

Failed run
Screenshot 2024-05-21 at 1 39 56 PM

Copy link

This issue has been marked as stale because it has not been commented on in two months.
Please reply in order to keep the issue open. Otherwise, it will close in 14 days.
Thank you for contributing!

@github-actions github-actions bot added the stale label Jul 21, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant