I have upgraded my dhis2 from 2.37 version to 2.40.8 , every thing is working fine also I have upgraded it to version by version. Everything is working fine , but my organization units are not loading, it keeps lading and nothing shows when I open my maintenance app and then open organization units.
Did you try testing this in the Guest mode of your browser (to ensure there’s no cache issue)? And before opening in Guest mode, please try Data Administration app > Maintenance > Clear Application Cache and Reload Apps.
If the issue persists, would you please share the entire Catalina.out log (without sensitive/authentication info)?
thanks for the reply first @Stephan_Mestach
well I have almost 16000 organization units, so its difficult to drill down the exact error, when I import export OU’s it can easily import, the only the problem is when i open any OU , the error stills same
this is error is weird, suggest either a record or a parent orgunit null and the client code doesn’t support it (which is weird since generally the top level orgunit has no parent)
you can change your browser normally to pause on caught and uncaught exception
this can be a bit tedious because there a lot exception but you might spot the bad data in the accessible variables
hey @Stephan_Mestach I have checked my maintenance app version its same v32.23.1, I have also installed new app Maintenance preview but the issue still same, also did multiple queries in my database to find null values, but no null values..
secondly one thing is that when I try to add also any new organization unit its not allowing me and showing the same error.
Hi @Mujtaba_Hussain
I’ve been reviewing all the details you mentioned and the questions from Stephan have been quite helpful. Sorry we’ve not been able to uncover what is going on, but hopefully we will get there.
Since we can’t reproduce this on any of the play instances, is there a test environment that could be accessible for debugging? I’d like to check if I could debug the issue (or share it with one of the team members when triaging this issue).
Here are some other things I would like you to try please:
Check this API request https://play.im.dhis2.org/stable-2-40-8-2/api/organisationUnits?filter=code:null&fields=*&pageSize=1&paging=false (replace the play URL), what do you get? If the API returns any result then try to update the value.
In the Maintenance app, go to SQL View under Other tab and create a SQL View with the query SELECT * FROM organisationunit; then update the sharing setting and execute. Is there an issue displaying the data there?
If you are still in version 2.40.7, maybe updating to the latest patch would be helpful as Stephan suggested above.
Try the whole process again: 1) Data Administration app > Everything in Maintenance, Resource Tables and then the Analytics Tables Export. Take note of any issues while monitoring the Console/Network tabs in Dev Tools 2) Next, open in Guest mode of your browser (sorry if might sound like a repetition but it’s to be 100% sure none of the steps were skipped).
I will let you know if I think of any other step. The whole point here is to debug and understand what’s causing the issue so do as much testing as possible to be able to provide more details of the issue.
Thanks!
How are you creating the new OU? Using the API or the UI? Could you share more details about the creation process? If you haven’t tried creating using the API, could you test that as well?
hey @Gassim first thanks for the time.
Well I have gone through all of your points and test one by one.
Point 1: I have tried the api and it doesnot return me the null it returns me the json, but I don’t the where exactly I should add the value because in json I have checked their is no null value, let me attached it here so that you can also see and let me know if u find any problem in my json.
Point 3: I am also considering this and also told my team to upgrade this, mean while I think may be problem is related to my ou data, but still I will create an instance and check, although I have also installed the new maintenance preview app but issue is still same for opening organization units. Point 4: Gone through 4 point and no success.
================
Second question: yes I have successfully added new OU but using an api postman and its add but when I try to open that OU it says same error and when trying t add or edit any new ou it shows the same error…
The API request is actually not supposed to return a result which means that all these ones that are returned actually have an empty ‘code’. You will need to make sure that all these have code configured. For example,
The OU Q6xsuKZDGHt in the screenshot from the JSON you shared needs to have “code” right below the “name” field (not under the other fields, but a main field).
Good to know that it’s loading. It looks like you might be able to find the information using the SQL View in a table view which might be easier than the JSON, so pleas try using this query:
SELECT * FROM organisationunit
WHERE code IS NULL;
as you can see from here the ones that have null, they need to be updated. The code that we are talking about here is the third field you see in the screenshot when configuring a metadata:
Yes, there has been bug issues before where if the OUs don’t have the Code, it breaks. I wonder if you update to the latest patch release if you’d still encounter this issue or not.
but the problem is does it work if I add the codes to null , because codes has also references from other database tables.. ?
secondly which latest patch release is stable 2.41?
hey @Gassim I have tried to fill the null values in my DB - OU table now query returns no null values … but it still returns the same error while editing or creating new OU.
An error occurred
Cannot destructure property ‘code’ of ‘object null’ as it is null.
UPDATE organisationunit
SET code = ‘OU’ || organisationunitid
WHERE code IS NULL;**
==============
Note:** Right now I do not yet updated the version , I am still working on my current version (2.40.8.2), versioning update is still pending, may be the problem is in my data not version.
If you run the API request (or the SQL query) and no longer get any results with null code, could you now check again when opening in the Guest mode of your browser?