akvo / akvo-lumen

Make sense of your data
https://akvo.org/akvo-lumen
GNU Affero General Public License v3.0
63 stars 18 forks source link

ENV Called twice #3166

Open dedenbangkit opened 1 year ago

dedenbangkit commented 1 year ago

Context

Env called twice and the second call got 500 responses because of NullPointerException

10.4.0.5 - - [22/Sep/2022:08:15:03 +0000] "GET /api/env HTTP/1.0" 500 21 "https://ci-fiji.akvolumen.org/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36" "118.96.137.79, 34.102.160.74"

Problem or idea

There are inconsistencies when we call env while nginx configuration forward env -> api/env

λ ag "(\'/env\')"
client/tools/devServer.js
24:    source: '/env',

client/src/utilities/auth.js
71:  return get('/env')

client/src/app.jsx
133:    get('/env')
161:    get('/env')
182:    get('/env')
λ ag "(\'/api/env\')"
src/app.jsx
121:      getWithToken(token, '/api/env').then(envresp => ({ profile: res.profile, env: Object.assign(res.env, envresp.body) }))
125:    get('/api/env').then(envresp => ({ profile: res.profile, env: Object.assign(res.env, envresp.body) }))

The second call issue: NullPointerException on env handler https://github.com/akvo/akvo-lumen/blob/b70d654733b7ce030af5244a1d4e83019dc21fb5/backend/src/akvo/lumen/endpoint/env.clj#L16-L42

Perhaps because of the tenant manager https://github.com/akvo/akvo-lumen/blob/b70d654733b7ce030af5244a1d4e83019dc21fb5/backend/src/akvo/lumen/endpoint/env.clj#L25

Solution or next step