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

Gradle updates fail with "undefined method `name' for nil:NilClass'" #4793

Closed
denebgarza opened this issue Mar 3, 2022 · 12 comments · Fixed by #6392
Closed

Gradle updates fail with "undefined method `name' for nil:NilClass'" #4793

denebgarza opened this issue Mar 3, 2022 · 12 comments · Fixed by #6392
Labels
L: java:gradle Maven packages via Gradle T: bug 🐞 Something isn't working

Comments

@denebgarza
Copy link

denebgarza commented Mar 3, 2022

Package ecosystem
gradle

dependabot.yml content

version: 2
updates:
  - package-ecosystem: gradle
    directory: /
    schedule:
      interval: daily
    open-pull-requests-limit: 10
    registries: "*"
registries:
  codeartifact:
    type: maven-repository
    url: https://redacted-private-repo.codeartifact.us-east-2.amazonaws.com/maven/releases
    username: aws
    password: ${{secrets.CODEARTIFACT_TOKEN}}

Updated dependency
The portion of the logs I posted below are for org.slf4j:slf4j-apibut the same error happens with all dependencies for which a newer version is found.

What you expected to see, versus what you actually saw
Expected: PRs opened for dependencies that need updating.
Actual: ERRORs in the logs for each dependency that needs updating. No PRs opened.

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


updater | INFO <job_308987315> Checking if org.slf4j:slf4j-api 1.7.32 needs updating
  proxy | 2022/03/03 12:19:45 [016] GET https://repo.maven.apache.org:443/maven2/org/slf4j/slf4j-api/maven-metadata.xml
  proxy | 2022/03/03 12:19:45 [016] 200 https://repo.maven.apache.org:443/maven2/org/slf4j/slf4j-api/maven-metadata.xml
  proxy | 2022/03/03 12:19:45 [018] GET https://redacted-private-repo.codeartifact.us-east-2.amazonaws.com:443/maven/releases/org/slf4j/slf4j-api/maven-metadata.xml
  proxy | 2022/03/03 12:19:45 [018] * authenticating maven repository request (host: redacted-private-repo.codeartifact.us-east-2.amazonaws.com)
  proxy | 2022/03/03 12:19:45 [018] 404 https://redacted-private-repo.codeartifact.us-east-2.amazonaws.com:443/maven/releases/org/slf4j/slf4j-api/maven-metadata.xml
updater | INFO <job_308987315> Latest version is 1.7.36
updater | INFO <job_308987315> Requirements to unlock own
updater | INFO <job_308987315> Requirements update strategy 
updater | INFO <job_308987315> Updating org.slf4j:slf4j-api from 1.7.32 to 1.7.36
updater | I, [2022-03-03T12:19:45.574280 #7]  INFO -- sentry: ** [Raven] Sending event d6b3bee060384cb5b5423b0fbe2b6458 to Sentry
  proxy | 2022/03/03 12:19:45 [020] POST https://sentry.io:443/api/1451818/store/
  proxy | 2022/03/03 12:19:45 [020] 200 https://sentry.io:443/api/1451818/store/
updater | ERROR <job_308987315> Error processing org.slf4j:slf4j-api (NoMethodError)
updater | ERROR <job_308987315> undefined method `name' for nil:NilClass
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-gradle-0.176.0/lib/dependabot/gradle/file_parser/property_value_finder.rb:123:in `properties'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-gradle-0.176.0/lib/dependabot/gradle/file_parser/property_value_finder.rb:104:in `block in property_details'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-gradle-0.176.0/lib/dependabot/gradle/file_parser/property_value_finder.rb:103:in `each'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-gradle-0.176.0/lib/dependabot/gradle/file_parser/property_value_finder.rb:103:in `property_details'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-gradle-0.176.0/lib/dependabot/gradle/file_parser/property_value_finder.rb:111:in `property_value'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-gradle-0.176.0/lib/dependabot/gradle/file_updater.rb:156:in `block in evaluate_properties'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-gradle-0.176.0/lib/dependabot/gradle/file_updater.rb:154:in `scan'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-gradle-0.176.0/lib/dependabot/gradle/file_updater.rb:154:in `evaluate_properties'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-gradle-0.176.0/lib/dependabot/gradle/file_updater.rb:135:in `block in original_buildfile_declaration'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-gradle-0.176.0/lib/dependabot/gradle/file_updater.rb:134:in `each'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-gradle-0.176.0/lib/dependabot/gradle/file_updater.rb:134:in `find'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-gradle-0.176.0/lib/dependabot/gradle/file_updater.rb:134:in `original_buildfile_declaration'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-gradle-0.176.0/lib/dependabot/gradle/file_updater.rb:117:in `update_version_in_buildfile'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-gradle-0.176.0/lib/dependabot/gradle/file_updater.rb:73:in `block in update_buildfiles_for_dependency'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-gradle-0.176.0/lib/dependabot/gradle/file_updater.rb:61:in `each'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-gradle-0.176.0/lib/dependabot/gradle/file_updater.rb:61:in `update_buildfiles_for_dependency'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-gradle-0.176.0/lib/dependabot/gradle/file_updater.rb:27:in `block in updated_dependency_files'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-gradle-0.176.0/lib/dependabot/gradle/file_updater.rb:26:in `each'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-gradle-0.176.0/lib/dependabot/gradle/file_updater.rb:26:in `updated_dependency_files'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:678:in `generate_dependency_files_for'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:274:in `check_and_create_pull_request'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:82:in `check_and_create_pr_with_error_handling'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:56:in `block in run'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:56:in `each'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:56:in `run'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/lib/dependabot/update_files_job.rb:17:in `perform_job'
updater | ERROR <job_308987315> /home/dependabot/dependabot-updater/lib/dependabot/base_job.rb:35:in `run'
updater | ERROR <job_308987315> bin/update_files.rb:22:in `<main>'
@denebgarza denebgarza added the T: bug 🐞 Something isn't working label Mar 3, 2022
@Akuka
Copy link

Akuka commented Mar 3, 2022

We are experiencing the same issue (with npm)

@jlowcs
Copy link

jlowcs commented Mar 3, 2022

@Akuka maybe this issue then?

@denebgarza
Copy link
Author

There's also this one for pip that was resolved a few months ago.

Not sure if they all have a similar root cause, but the error messages do look suspiciously similar 😄

@Nishnha Nishnha added the L: java:gradle Maven packages via Gradle label Mar 3, 2022
@Nishnha
Copy link
Member

Nishnha commented Mar 8, 2022

Hi @denebgarza,

I'm not super familiar with these Dependabot ecosystems, but it looks like Dependabot is failing to parse the name of the dependency from your Gradle buildfile.

Could you share the relevant parts of the manifest file(s) you're using?

@denebgarza
Copy link
Author

Nothing noteworthy about the manifest. It's all pretty basic. Issue seems to have fixed itself without any changes. Closing the issue. Thanks!

@savdeev
Copy link

savdeev commented Apr 1, 2022

Hey we currently experiencing the same issue with grade project.

...
updater | INFO <job_333270514> Starting job processing
updater | INFO <job_333270514> Starting update job for traderepublic/tr-securities-services
updater | ERROR <job_333270514> undefined method `name' for nil:NilClass
updater | ERROR <job_333270514> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-gradle-0.180.2/lib/dependabot/gradle/file_parser/property_value_finder.rb:123:in `properties'
updater | ERROR <job_333270514> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-gradle-0.180.2/lib/dependabot/gradle/file_parser/property_value_finder.rb:104:in `block in property_details'
...

@savdeev
Copy link

savdeev commented Apr 1, 2022

Found a culprit that was causing the issues:

...
object Version {
    const val awsSdk = "0.14.0-beta"
}

dependencies {
    implementation("aws.sdk.kotlin:s3:${Version.awsSdk}")
    implementation("aws.sdk.kotlin:sqs:${Version.awsSdk}")
}
...

@Nishnha
Copy link
Member

Nishnha commented Apr 4, 2022

@savdeev Can you provide more detail into how this was causing the issue? It seems like Version.awsSdk would be accessible in this scenario.

@Nishnha Nishnha reopened this Apr 4, 2022
@jeffwidman
Copy link
Member

gentle nudge @savdeev

@savdeev
Copy link

savdeev commented Nov 25, 2022

Hey, after we removed version variables Object and specified version string explicitly in the dependency declarstuon problem have disappeared. I am still not sure what was the root cause. NOw having versions as a top level variable and dependabot works as expected.

@jeffwidman
Copy link
Member

Probably fixed by #6392, but unclear... so if it's still happening once this is deployed (sometime this week), then please comment and we can re-open.

@HariSekhon
Copy link

HariSekhon commented Aug 22, 2023

Related to #7864

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

Successfully merging a pull request may close this issue.

7 participants