Skip to content

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

@MarkSiemers-msr

Description

@MarkSiemers-msr

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions