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
Getting domains fails with "undefined method 'organization' for nil:NilClass" #2335
Comments
philippthun
added a commit
to sap-contributions/cloud_controller_ng
that referenced
this issue
Jun 11, 2021
5 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue
Requests to
/v3/domains
and/v3/organizations/:org_guid/domains
fail when user has a space-scoped role and one of the spaces for this role is deleted in parallel to handling one of the above requests.Context
Getting readable orgs for space-scoped roles involves multiple database queries (i.e. first getting the space guids and then getting the org guid for each space). The current implementation cannot handle the situation when
Space.find
returnsnil
. This results in the following error:undefined method 'organization' for nil:NilClass
leading to an HTTP 500 returned by cloud controller.Steps to Reproduce
It's hard to reproduce, as it happens on huge foundations when there are users with access to many spaces and spaces getting deleted quite frequently (e.g. during some integration tests). It is possible to simulate the error in a debugger though (i.e. halt execution and delete rows from the database).
Expected result
Spaces that are gone should just be ignored.
Possible Fix
Use the safe navigation operator as done for the other
<Model>.find
occurrences in permissions.rb.The text was updated successfully, but these errors were encountered: