Attempting to list projects through the API results in error 500 after upgrade to 17.3
After an upgrade to 17.3, one of our internal tools fails to fetch our projects:
x.x.x.x - - [16/Aug/2024:06:43:45 +0000] "GET /api/v4/projects?per_page=100&page=1 HTTP/1.1" 500 39 "" "-" -
From production.log:
NoMethodError (undefined method `pre_receive_secret_detection_enabled' for nil:NilClass
project.security_setting.pre_receive_secret_detection_enabled
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^):
/opt/gitlab/embedded/service/gitlab-rails/ee/lib/ee/api/entities/project.rb:42:in `block (2 levels) in <module:Project>'
/opt/gitlab/embedded/lib/ruby/gems/3.1.0/gems/grape-entity-1.0.1/lib/grape_entity/entity.rb:518:in `instance_exec'
/opt/gitlab/embedded/lib/ruby/gems/3.1.0/gems/grape-entity-1.0.1/lib/grape_entity/entity.rb:518:in `exec_with_object'
/opt/gitlab/embedded/lib/ruby/gems/3.1.0/gems/grape-entity-1.0.1/lib/grape_entity/exposure/block_exposure.rb:10:in `value'
/opt/gitlab/embedded/lib/ruby/gems/3.1.0/gems/grape-entity-1.0.1/lib/grape_entity/exposure/base.rb:91:in `valid_value'
[..]
Installed using the 17.3.0-ee.0.sles15 package running on openSUSE Leap 15.5, after an upgrade from gitlab-ee-17.2.2-ee.0.sles15.
Potential Workarounds (in preferential order)
- Disable the feature flag
- Make the change we are making in the patch
- Comment out the offending code
- Run a SQL command to generate the missing records
Please note that you should only need to implement one of these.
Next Patch Release
The next patch release for 17.3 will be September 11, 2024.
Edited by rossfuhrman