Skip to content
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

ENV Called twice #3166

Open
dedenbangkit opened this issue Sep 22, 2022 · 0 comments
Open

ENV Called twice #3166

dedenbangkit opened this issue Sep 22, 2022 · 0 comments
Assignees

Comments

@dedenbangkit
Copy link
Member

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

(defn handler
[{:keys [public-client flow-api lumen-deployment-color lumen-deployment-environment
lumen-deployment-version piwik-site-id sentry-client-dsn
tenant-manager]}]
(fn [{tenant :tenant
:as request}]
(let [{:keys [url client-id end-session-endpoint-suffix open-id-config]} public-client]
(response/response
(if (get-in request [:jwt-claims "sub"])
{"environment" (env/all (p/connection tenant-manager (:tenant request)))}
(cond-> {"auth" {"clientId" client-id
"url" url
"domain" (:issuer open-id-config)
"endpoints" {"issuer" (:issuer open-id-config)
"authorization" (:authorization_endpoint open-id-config)
"userinfo" (:userinfo_endpoint open-id-config)
"endSession" (:end_session_endpoint open-id-config (str (:issuer open-id-config) end-session-endpoint-suffix))
"jwksUri" (:jwks_uri open-id-config)}}
"flowApiUrl" (:url flow-api)
"lumenDeploymentColor" lumen-deployment-color
"lumenDeploymentEnvironment" lumen-deployment-environment
"lumenDeploymentVersion" lumen-deployment-version
"piwikSiteId" piwik-site-id
"tenant" (:tenant request)
"environment" {}}
(string? sentry-client-dsn)
(assoc "sentryDSN" sentry-client-dsn)))))))

Perhaps because of the tenant manager

{"environment" (env/all (p/connection tenant-manager (:tenant request)))}

Solution or next step

  • Fix API call endpoint on Client
  • Try Catch the tenant-manager
  • Stacktrace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants