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

npm updates fail with "Error processing xyz (NoMethodError)" #4775

Closed
jlowcs opened this issue Feb 28, 2022 · 6 comments · Fixed by #4802
Closed

npm updates fail with "Error processing xyz (NoMethodError)" #4775

jlowcs opened this issue Feb 28, 2022 · 6 comments · Fixed by #4802
Labels
L: javascript:npm npm packages via npm T: bug 🐞 Something isn't working

Comments

@jlowcs
Copy link

jlowcs commented Feb 28, 2022

Package ecosystem
npm
Package manager version
npm 8.1.2
Language version
node 16.3.2
Manifest location and content prior to update

dependabot.yml content

version: 2
registries:
  npm-github:
    type: npm-registry
    url: https://npm.pkg.github.com
    token: ${{secrets.ACCESS_TOKEN}}
updates:
  - package-ecosystem: npm
    directory: /
    registries:
      - npm-github
    schedule:
      interval: daily
    open-pull-requests-limit: 10
    ignore:
      - dependency-name: "@types/node"
        update-types: ["version-update:semver-major"]
      - dependency-name: "webpack"
        update-types: ["version-update:semver-major"]
      - dependency-name: "@types/webpack"
        update-types: ["version-update:semver-major"]
      - dependency-name: "webpack-cli"
        update-types: ["version-update:semver-major"]
      - dependency-name: "webpack-assets-manifest"
        update-types: ["version-update:semver-major"]
      - dependency-name: "@types/webpack-assets-manifest"
        update-types: ["version-update:semver-major"]
      - dependency-name: "webpack-dev-server"
        update-types: ["version-update:semver-major"]
      - dependency-name: "@types/webpack-dev-server"
        update-types: ["version-update:semver-major"]
      - dependency-name: "webpack-retry-chunk-load-plugin"
        update-types: ["version-update:semver-major"]
      - dependency-name: "copy-webpack-plugin"
        update-types: ["version-update:semver-major"]
      - dependency-name: "@types/copy-webpack-plugin"
        update-types: ["version-update:semver-major"]
      - dependency-name: "html-webpack-plugin"
        update-types: ["version-update:semver-major"]
      - dependency-name: "clean-webpack-plugin"
        update-types: ["version-update:semver-major"]
      - dependency-name: "terser-webpack-plugin"
        update-types: ["version-update:semver-major"]
      - dependency-name: "@types/terser-webpack-plugin"
        update-types: ["version-update:semver-major"]
      - dependency-name: "webpack-subresource-integrity"
        update-types: ["version-update:semver-major"]
      - dependency-name: "@types/webpack-subresource-integrity"
        update-types: ["version-update:semver-major"]
      - dependency-name: "source-map-loader"
        update-types: ["version-update:semver-major"]
      - dependency-name: "jest-when"
        update-types: ["version-update:semver-major"]
      - dependency-name: "http-proxy-middleware"
        update-types: ["version-update:semver-major"]
      - dependency-name: "history"
        update-types: ["version-update:semver-major"]
      - dependency-name: "react-router"
        update-types: ["version-update:semver-major"]
      - dependency-name: "react-router-dom"
        update-types: ["version-update:semver-major"]
      - dependency-name: "glob-parent"
        update-types: ["version-update:semver-major"]
      - dependency-name: "node-fetch"
        update-types: ["version-update:semver-major"]
      - dependency-name: "@types/node-fetch"
        update-types: ["version-update:semver-major"]
      - dependency-name: "jsdom"
        update-types: ["version-update:semver-major"]
      - dependency-name: "graphql"
        update-types: ["version-update:semver-major"]

Updated dependency

What you expected to see, versus what you actually saw

The following error is encountered 5 times (for packages that need updating), then the script stops and fails.

updater | INFO <job_304487419> Updating eslint from 8.9.0 to 8.10.0
updater | I, [2022-02-28T15:38:03.290226 #7]  INFO -- sentry: ** [Raven] Sending event 5f8cb241d5e5447d8121a3b1be97b68a to Sentry
  proxy | 2022/02/28 15:38:03 [230] POST https://sentry.io:443/api/1451818/store/
  proxy | 2022/02/28 15:38:03 [230] 200 https://sentry.io:443/api/1451818/store/
updater | ERROR <job_304487419> Error processing eslint (NoMethodError)
updater | ERROR <job_304487419> undefined method `length' for nil:NilClass
updater | ERROR <job_304487419> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.175.0/lib/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater.rb:503:in `detect_indentation'
updater | ERROR <job_304487419> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.175.0/lib/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater.rb:522:in `lock_git_deps'
updater | ERROR <job_304487419> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.175.0/lib/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater.rb:474:in `block in write_temporary_dependency_files'
updater | ERROR <job_304487419> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.175.0/lib/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater.rb:458:in `each'
updater | ERROR <job_304487419> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.175.0/lib/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater.rb:458:in `write_temporary_dependency_files'
updater | ERROR <job_304487419> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.175.0/lib/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater.rb:59:in `block in updated_lockfile_content'
updater | ERROR <job_304487419> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-common-0.175.0/lib/dependabot/shared_helpers.rb:48:in `block in in_a_temporary_directory'
updater | ERROR <job_304487419> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-common-0.175.0/lib/dependabot/shared_helpers.rb:48:in `chdir'
updater | ERROR <job_304487419> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-common-0.175.0/lib/dependabot/shared_helpers.rb:48:in `in_a_temporary_directory'
updater | ERROR <job_304487419> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.175.0/lib/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater.rb:58:in `updated_lockfile_content'
updater | ERROR <job_304487419> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.175.0/lib/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater.rb:29:in `updated_lockfile'
updater | ERROR <job_304487419> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.175.0/lib/dependabot/npm_and_yarn/file_updater.rb:190:in `updated_lockfile_content'
updater | ERROR <job_304487419> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.175.0/lib/dependabot/npm_and_yarn/file_updater.rb:118:in `package_lock_changed?'
updater | ERROR <job_304487419> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.175.0/lib/dependabot/npm_and_yarn/file_updater.rb:147:in `block in updated_lockfiles'
updater | ERROR <job_304487419> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.175.0/lib/dependabot/npm_and_yarn/file_updater.rb:146:in `each'
updater | ERROR <job_304487419> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.175.0/lib/dependabot/npm_and_yarn/file_updater.rb:146:in `updated_lockfiles'
updater | ERROR <job_304487419> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.175.0/lib/dependabot/npm_and_yarn/file_updater.rb:39:in `updated_dependency_files'
updater | ERROR <job_304487419> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:678:in `generate_dependency_files_for'
updater | ERROR <job_304487419> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:274:in `check_and_create_pull_request'
updater | ERROR <job_304487419> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:82:in `check_and_create_pr_with_error_handling'
updater | ERROR <job_304487419> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:56:in `block in run'
updater | ERROR <job_304487419> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:56:in `each'
updater | ERROR <job_304487419> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:56:in `run'
updater | ERROR <job_304487419> /home/dependabot/dependabot-updater/lib/dependabot/update_files_job.rb:17:in `perform_job'
updater | ERROR <job_304487419> /home/dependabot/dependabot-updater/lib/dependabot/base_job.rb:35:in `run'
updater | ERROR <job_304487419> bin/update_files.rb:22:in `<main>'

This only happens on one of our privates repositories. None of our other repositories have that issue.

Native package manager behavior

Everything works as expected.

@jlowcs jlowcs added the T: bug 🐞 Something isn't working label Feb 28, 2022
@jlowcs
Copy link
Author

jlowcs commented Feb 28, 2022

Could it be related to 36dfd7c?

@jlowcs
Copy link
Author

jlowcs commented Feb 28, 2022

I'm not fluent in ruby, but I'm wondering whether the issue might be caused by updated_content having the value from updated_package_json_content(file) which might not contain any indentation?

@jlowcs
Copy link
Author

jlowcs commented Feb 28, 2022

Could we at least do something like the following as a quick fix?

        def detect_indentation(json)
          indentation = json.scan(/^\s+/).min_by(&:length)

          return "  " if indentation.nil?

          indentation_size = indentation.length
          indentation_type = indentation.scan(/\t/).any? ? "\t" : " "

          indentation_type * indentation_size
        end

@jlowcs
Copy link
Author

jlowcs commented Mar 1, 2022

@jurre since you are the author of 36dfd7c, do you think we could find a way to get this fixed? Another one of our repos is now blocked by it :/

@jlowcs jlowcs changed the title Error processing xyz (NoMethodError) npm updates fail with "Error processing xyz (NoMethodError)" Mar 3, 2022
@mctofu mctofu added the L: javascript:npm npm packages via npm label Mar 3, 2022
@Nishnha
Copy link
Member

Nishnha commented Mar 3, 2022

Hi @jlowcs, I think the fix you mentioned in #4775 (comment) is appropriate.

I'll work on getting this fixed over the next day and keep you updated on it here.

@Akuka
Copy link

Akuka commented Mar 4, 2022

We are experiencing the same issue
Our dependabot configuration: interval: "weekly" - the last successful run was last week

Log:

updater | INFO <job_310014558> Updating @typescript-eslint/parser from 5.12.1 to 5.13.0
updater | I, [2022-03-04T12:18:25.103873 #6]  INFO -- sentry: ** [Raven] Sending event 1ac04beebb5045198684ef93048add7d to Sentry
  proxy | 2022/03/04 12:18:25 [044] POST https://sentry.io:443/api/1451818/store/
  proxy | 2022/03/04 12:18:25 [044] 200 https://sentry.io:443/api/1451818/store/
updater | ERROR <job_310014558> Error processing @typescript-eslint/parser (NoMethodError)
updater | ERROR <job_310014558> undefined method `length' for nil:NilClass
updater | ERROR <job_310014558> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.176.0/lib/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater.rb:503:in `detect_indentation'
updater | ERROR <job_310014558> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.176.0/lib/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater.rb:564:in `lock_deps_with_latest_reqs'
updater | ERROR <job_310014558> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.176.0/lib/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater.rb:476:in `block in write_temporary_dependency_files'
updater | ERROR <job_310014558> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.176.0/lib/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater.rb:458:in `each'
updater | ERROR <job_310014558> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.176.0/lib/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater.rb:458:in `write_temporary_dependency_files'
updater | ERROR <job_310014558> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.176.0/lib/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater.rb:59:in `block in updated_lockfile_content'
updater | ERROR <job_310014558> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-common-0.176.0/lib/dependabot/shared_helpers.rb:48:in `block in in_a_temporary_directory'
updater | ERROR <job_310014558> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-common-0.176.0/lib/dependabot/shared_helpers.rb:48:in `chdir'
updater | ERROR <job_310014558> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-common-0.176.0/lib/dependabot/shared_helpers.rb:48:in `in_a_temporary_directory'
updater | ERROR <job_310014558> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.176.0/lib/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater.rb:58:in `updated_lockfile_content'
updater | ERROR <job_310014558> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.176.0/lib/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater.rb:29:in `updated_lockfile'
updater | ERROR <job_310014558> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.176.0/lib/dependabot/npm_and_yarn/file_updater.rb:190:in `updated_lockfile_content'
updater | ERROR <job_310014558> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.176.0/lib/dependabot/npm_and_yarn/file_updater.rb:118:in `package_lock_changed?'
updater | ERROR <job_310014558> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.176.0/lib/dependabot/npm_and_yarn/file_updater.rb:147:in `block in updated_lockfiles'
updater | ERROR <job_310014558> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.176.0/lib/dependabot/npm_and_yarn/file_updater.rb:146:in `each'
updater | ERROR <job_310014558> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.176.0/lib/dependabot/npm_and_yarn/file_updater.rb:146:in `updated_lockfiles'
updater | ERROR <job_310014558> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-npm_and_yarn-0.176.0/lib/dependabot/npm_and_yarn/file_updater.rb:39:in `updated_dependency_files'
updater | ERROR <job_310014558> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:678:in `generate_dependency_files_for'
updater | ERROR <job_310014558> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:274:in `check_and_create_pull_request'
updater | ERROR <job_310014558> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:82:in `check_and_create_pr_with_error_handling'
updater | ERROR <job_310014558> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:56:in `block in run'
updater | ERROR <job_310014558> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:56:in `each'
updater | ERROR <job_310014558> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:56:in `run'
updater | ERROR <job_310014558> /home/dependabot/dependabot-updater/lib/dependabot/update_files_job.rb:17:in `perform_job'
updater | ERROR <job_310014558> /home/dependabot/dependabot-updater/lib/dependabot/base_job.rb:35:in `run'
updater | ERROR <job_310014558> bin/update_files.rb:22:in `<main>'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: javascript:npm npm packages via npm T: bug 🐞 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants