Open klondikemarlen opened 1 year ago
Identified issue when logging in production mode, log detail is significantly reduced. The logger completely loses context of repo source and throws all errors against node. See https://app.glitchtip.com/ice-fog-analytics/issues/2572355?project=3732. Running error logging in development mode gives full file location and code source details.
I did find one issue in src/api/src/middleware/index.ts
.
export async function loadStudent(req: Request, res: Response, next: NextFunction) {
if (req.oidc.isAuthenticated() && req.oidc.user) {
return proxyService
.proxy(`/student/${req.oidc.user.sub}`, "get")
.then((resp) => {
req.student = resp.data.data;
})
resp
can be undefined
when proxy calls fail. This then fails when calling resp.data
, it would also fail if you tried to call resp.status
Generally I would expect the response to always exist, and only the data to be missing.
Identified source of proxy response undefined in src/api/src/services/proxy-service.ts
The code
return axios
.request({ url: `${PROXY_BASE_URL}${path}`, data, method })
.then((resp) => resp)
.catch((e) => {
Sentry.captureException(e);
return undefined;
});
Should probably continue to raise the error. i.e.
.catch((e) => {
Sentry.captureException(e);
throw e
});
or should return some kind of valid response object e.g.
.catch((e) => {
Sentry.captureException(e);
return e.response
});
See https://app.glitchtip.com/ice-fog-analytics/issues/2457325?project=3423
Context
During login user is being created multiple times?
It might be worth looking into https://docs.sentry.io/platforms/node/guides/express/ to see if that will give us better logging.
I also need to boot up my local environment with the development GlitchTip at https://app.glitchtip.com/ice-fog-analytics/issues?project=3732 and see if I can re-create locally.
While this issue is in the
student-financial-aid
repo, it will likely require solutioning across thesfa-client
repo as well.