Skip to content

Grouped bundler update fails with "undefined method `force_encoding' for nil:NilClass" #7319

Closed
@jdelStrother

Description

Is there an existing issue for this?

  • I have searched the existing issues

Package ecosystem

Bundler

Package manager version

2.4.12

Language version

Ruby 3.2.2

Manifest location and content before the Dependabot update

/Gemfile

dependabot.yml content

version: 2

registries:
  contribsys: # Define access for Sidekiq/contribsys registry
    type: rubygems-server
    url: https://enterprise.contribsys.com/
    username: ${{secrets.SIDEKIQ_USERNAME}}
    password: ${{secrets.SIDEKIQ_PASSWORD}}

  ruby-github:
    type: rubygems-server
    url: https://rubygems.pkg.github.com/audioboom/
    token: ${{ secrets.GH_PACKAGE_REGISTRY_TOKEN }}

updates:
  - package-ecosystem: bundler
    directory: "/"
    schedule:
      interval: daily
    open-pull-requests-limit: 99
    # This seems bad, but is the default for rubygems.org, as far as I can tell.
    # So it's only necessary because we added contribsys for Sidekiq,
    # which I think we have to assume is probably fine.
    insecure-external-code-execution: allow
    registries:
      - contribsys
      - ruby-github
    vendor: true

    groups:
      rubocop-dependencies:
        patterns:
          - "rubocop*"
      rspec-dependencies:
        patterns:
          - "rspec*"
      cloud-service-dependencies:
        # Both AWS & Google Cloud have lots of auto-generated releases with not-very-helpful release notes.
        # Just group them into one big update
        patterns:
          - "aws-*"
          - "google-*"
      flipper-dependencies:
        patterns:
          - "flipper*"
      sidekiq-dependencies:
        patterns:
          - "sidekiq*"
      sentry-dependencies:
        patterns:
          - "sentry*"

Updated dependency

No response

What you expected to see, versus what you actually saw

Since enabling grouped updates, our dependabot updates fail with -

...
  proxy | 2023/05/14 07:59:44 [216] GET https://index.rubygems.org:443/versions
  proxy | 2023/05/14 07:59:44 [216] 304 https://index.rubygems.org:443/versions
  proxy | 2023/05/14 08:00:14 [218] GET https://rubygems.org:443/gems/rubocop-1.51.0.gem
  proxy | 2023/05/14 08:00:14 [218] 200 https://rubygems.org:443/gems/rubocop-1.51.0.gem
updater | 2023/05/14 08:00:20 ERROR <job_662289885> undefined method `force_encoding' for nil:NilClass
updater | 
updater |       string = string.dup.force_encoding(encoding)
updater |                          ^^^^^^^^^^^^^^^
updater | 2023/05/14 08:00:20 ERROR <job_662289885> /home/dependabot/dependabot-updater/vendor/ruby/3.1.0/gems/parser-3.2.2.0/lib/parser/base.rb:98:in `setup_source_buffer'
updater | 2023/05/14 08:00:20 ERROR <job_662289885> /home/dependabot/dependabot-updater/vendor/ruby/3.1.0/gems/parser-3.2.2.0/lib/parser/base.rb:32:in `parse'
updater | 2023/05/14 08:00:20 ERROR <job_662289885> /home/dependabot/bundler/lib/dependabot/bundler/file_parser/gemfile_declaration_finder.rb:45:in `parsed_gemfile'
updater | 2023/05/14 08:00:20 ERROR <job_662289885> /home/dependabot/bundler/lib/dependabot/bundler/file_parser/gemfile_declaration_finder.rb:50:in `declaration_node'
updater | 2023/05/14 08:00:20 ERROR <job_662289885> /home/dependabot/bundler/lib/dependabot/bundler/file_parser/gemfile_declaration_finder.rb:17:in `gemfile_includes_dependency?'
updater | 2023/05/14 08:00:20 ERROR <job_662289885> /home/dependabot/bundler/lib/dependabot/bundler/file_parser.rb:55:in `block (2 levels) in gemfile_dependencies'
updater | 2023/05/14 08:00:20 ERROR <job_662289885> /home/dependabot/bundler/lib/dependabot/bundler/file_parser.rb:54:in `each'
updater | 2023/05/14 08:00:20 ERROR <job_662289885> /home/dependabot/bundler/lib/dependabot/bundler/file_parser.rb:54:in `block in gemfile_dependencies'
updater | 2023/05/14 08:00:20 ERROR <job_662289885> /home/dependabot/bundler/lib/dependabot/bundler/file_parser.rb:51:in `each'
updater | 2023/05/14 08:00:20 ERROR <job_662289885> /home/dependabot/bundler/lib/dependabot/bundler/file_parser.rb:51:in `gemfile_dependencies'
updater | 2023/05/14 08:00:20 ERROR <job_662289885> /home/dependabot/bundler/lib/dependabot/bundler/file_parser.rb:23:in `parse'
updater | 2023/05/14 08:00:20 ERROR <job_662289885> /home/dependabot/dependabot-updater/lib/dependabot/updater/group_update_creation.rb:31:in `block in compile_all_dependency_changes_for'
updater | 2023/05/14 08:00:20 ERROR <job_662289885> /home/dependabot/dependabot-updater/lib/dependabot/updater/group_update_creation.rb:29:in `each'
updater | 2023/05/14 08:00:20 ERROR <job_662289885> /home/dependabot/dependabot-updater/lib/dependabot/updater/group_update_creation.rb:29:in `compile_all_dependency_changes_for'
updater | 2023/05/14 08:00:20 ERROR <job_662289885> /home/dependabot/dependabot-updater/lib/dependabot/updater/operations/group_update_all_versions.rb:86:in `block in run_grouped_dependency_updates'
updater | 2023/05/14 08:00:20 ERROR <job_662289885> /home/dependabot/dependabot-updater/lib/dependabot/updater/operations/group_update_all_versions.rb:75:in `each'
updater | 2023/05/14 08:00:20 ERROR <job_662289885> /home/dependabot/dependabot-updater/lib/dependabot/updater/operations/group_update_all_versions.rb:75:in `run_grouped_dependency_updates'
updater | 2023/05/14 08:00:20 ERROR <job_662289885> /home/dependabot/dependabot-updater/lib/dependabot/updater/operations/group_update_all_versions.rb:43:in `perform'
updater | 2023/05/14 08:00:20 ERROR <job_662289885> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:72:in `run'
updater | 2023/05/14 08:00:20 ERROR <job_662289885> /home/dependabot/dependabot-updater/lib/dependabot/update_files_command.rb:38:in `perform_job'
updater | 2023/05/14 08:00:20 ERROR <job_662289885> /home/dependabot/dependabot-updater/lib/dependabot/base_command.rb:52:in `run'
updater | 2023/05/14 08:00:20 ERROR <job_662289885> bin/update_files.rb:23:in `<main>'
updater | 2023/05/14 08:00:20 INFO <job_662289885> Sending event ad23e13cd224427599efae059be3ccab to Sentry
  proxy | 2023/05/14 08:00:21 [220] POST https://sentry.io:443/api/1451818/store/
  proxy | 2023/05/14 08:00:21 [220] 200 https://sentry.io:443/api/1451818/store/
updater | 2023/05/14 08:00:21 INFO Results:
updater | Dependabot encountered '1' error(s) during execution, please check the logs for more details.
updater | +---------------+
updater | |    Errors     |
updater | +---------------+
updater | | unknown_error |
updater | +---------------+
updater | time="2023-05-14T08:00:21Z" level=info msg="task complete" container_id=job-662289885-updater exit_code=0 job_id=662289885 step=updater

I can share the rest of the log & our Gemfile if there's somewhere private I can send them?

Native package manager behavior

No response

Images of the diff or a link to the PR, issue, or logs

No response

Smallest manifest that reproduces the issue

No response

Metadata

Assignees

Labels

F: grouped-updates 🎳Relates to bumping more than one dependency in a single PRT: bug 🐞Something isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions