Failed to load resource; 502 bad gateway on DHIS2 2.31.5

Hello @phil,
I am encountering some strange behavior with the maintenance app on 2.31.5.

I was trying to delete a data element I had just created and after clicking confirm, I got the message that “undefined was not deleted”.
When I looked in the browser console, I saw this error: “Failed to load resource: the server responded with a status of 502 (bad gateway)”

Here are some of the errors as seen in the console:
Api.js:342 GET https://url/api/29/userDataStore/maintenance 404 (Not Found)
(anonymous) @ Api.js:342
value @ Api.js:339
value @ Api.js:142
value @ BaseStore.js:80
value @ UserDataStore.js:97
(anonymous) @ epics.js:26
tryCatch @ polyfill.min.js:3
invoke @ polyfill.min.js:3
t. @ polyfill.min.js:3
r @ maintenance-216b34a42c1ea7e8e132.js:33381
(anonymous) @ maintenance-216b34a42c1ea7e8e132.js:33381
(anonymous) @ maintenance-216b34a42c1ea7e8e132.js:33381
(anonymous) @ epics.js:23
i @ maintenance.js:67
Promise.then (async)
(anonymous) @ maintenance.js:107
t @ bootstrap 216b34a42c1ea7e8e132:54
window.webpackJsonp @ bootstrap 216b34a42c1ea7e8e132:25
(anonymous) @ maintenance-216b34a42c1ea7e8e132.js:1
Api.js:351 API request failed with status 404 Not Found
Request: GET …/api/29/userDataStore/maintenance
(anonymous) @ Api.js:351
Promise.then (async)
(anonymous) @ Api.js:349
Promise.then (async)
(anonymous) @ Api.js:342
value @ Api.js:339
value @ Api.js:142
value @ BaseStore.js:80
value @ UserDataStore.js:97
(anonymous) @ epics.js:26
tryCatch @ polyfill.min.js:3
invoke @ polyfill.min.js:3
t. @ polyfill.min.js:3
r @ maintenance-216b34a42c1ea7e8e132.js:33381
(anonymous) @ maintenance-216b34a42c1ea7e8e132.js:33381
(anonymous) @ maintenance-216b34a42c1ea7e8e132.js:33381
(anonymous) @ epics.js:23
i @ maintenance.js:67
Promise.then (async)
(anonymous) @ maintenance.js:107
t @ bootstrap 216b34a42c1ea7e8e132:54
window.webpackJsonp @ bootstrap 216b34a42c1ea7e8e132:25
(anonymous) @ maintenance-216b34a42c1ea7e8e132.js:1

2DevTools failed to parse SourceMap: https://url/dhis-web-maintenance/maintenance-216b34a42c1ea7e8e132.js.map

Api.js:342 DELETE https://url/api/29/dataElements/r557J663Puv 502 (Bad Gateway)
(anonymous) @ Api.js:342
value @ Api.js:339
value @ Api.js:200
value @ ModelDefinition.js:414
value @ ModelBase.js:191
onActionTouchTap @ ContextActions.js:70
n.handleTouchTap @ EnhancedButton.js:153
r @ ReactErrorUtils.js:26
a @ EventPluginUtils.js:85
s @ EventPluginUtils.js:108
f @ EventPluginHub.js:43
v @ EventPluginHub.js:54
n @ forEachAccumulated.js:24
processEventQueue @ EventPluginHub.js:257
r @ ReactEventEmitterMixin.js:17
handleTopLevel @ ReactEventEmitterMixin.js:28
i @ ReactEventListener.js:72
perform @ Transaction.js:140
batchedUpdates @ ReactDefaultBatchingStrategy.js:62
i @ ReactUpdates.js:97
dispatchEvent @ ReactEventListener.js:147
Api.js:351 API request failed with status 502 Bad Gateway
Request: DELETE https://url/api/29/dataElements/r557J663Puv
(anonymous) @ Api.js:351
Promise.then (async)
(anonymous) @ Api.js:349
Promise.then (async)
(anonymous) @ Api.js:342
value @ Api.js:339
value @ Api.js:200
value @ ModelDefinition.js:414
value @ ModelBase.js:191
onActionTouchTap @ ContextActions.js:70
n.handleTouchTap @ EnhancedButton.js:153
r @ ReactErrorUtils.js:26
a @ EventPluginUtils.js:85
s @ EventPluginUtils.js:108
f @ EventPluginHub.js:43
v @ EventPluginHub.js:54
n @ forEachAccumulated.js:24
processEventQueue @ EventPluginHub.js:257
r @ ReactEventEmitterMixin.js:17
handleTopLevel @ ReactEventEmitterMixin.js:28
i @ ReactEventListener.js:72
perform @ Transaction.js:140
batchedUpdates @ ReactDefaultBatchingStrategy.js:62
i @ ReactUpdates.js:97
dispatchEvent @ ReactEventListener.js:147
ContextActions.js:93

502 Bad Gateway

502 Bad Gateway


nginx/1.10.3 (Ubuntu)

(anonymous) @ ContextActions.js:93
Promise.catch (async)
onActionTouchTap @ ContextActions.js:92
n.handleTouchTap @ EnhancedButton.js:153
r @ ReactErrorUtils.js:26
a @ EventPluginUtils.js:85
s @ EventPluginUtils.js:108
f @ EventPluginHub.js:43
v @ EventPluginHub.js:54
n @ forEachAccumulated.js:24
processEventQueue @ EventPluginHub.js:257
r @ ReactEventEmitterMixin.js:17
handleTopLevel @ ReactEventEmitterMixin.js:28
i @ ReactEventListener.js:72
perform @ Transaction.js:140
batchedUpdates @ ReactDefaultBatchingStrategy.js:62
i @ ReactUpdates.js:97

I have tried to reproduce this on the demo site but not getting these errors.

I can create data elements and clone them but cannot delete.

Please, could you or anyone provide any insight into what is happening and how we can fix?

Thanks

1 Like

Thanks for the detailed report! To me this seems like a backend-problem, but it’s quite strange that you get a 502-error, as this often means that the server is not reachable through your reverse-proxy or some other server-setup error. Do you get this consistently and only when you are deleting a data element? Are you able to refresh the page and everything else is working/loading?

Regarding the error-message from the frontend “undefined was not deleted”: this is a small bug in the error-handling code (it’s using “name” instead of “displayname”). The culprit is the 502-error.

Thank you @birkbjo for responding to this. Really appreciated.
We have just recently upgraded to 2.31.5 from 2.30. While on 2.30, we could not delete Programs, had issues with configuring grey fields, had indicators on custom forms that show up as blank (even though no errors in the indicator formula) and after the upgrade encountered this yesterday.
I had reported these issues here on the community and still expecting folks who can provide help or guidance to help us.
I will ask our IT folks to take a look at the server setup to see what could have gone wrong.