···1616# Throw-away build stage to reduce size of final image
1717FROM base AS build
18181919+# Accept build argument for git SHA (for Sentry release tracking)
2020+ARG GIT_SHA
2121+1922# Install packages needed to build node modules
2023RUN apt-get update -qq && \
2124 apt-get install --no-install-recommends -y build-essential node-gyp pkg-config python-is-python3
···36393740# Final stage for app image
3841FROM base
4242+4343+# Accept build argument for git SHA (needs to be declared in each stage)
4444+ARG GIT_SHA
4545+4646+# Set as environment variable for runtime access (Sentry release tracking)
4747+ENV GIT_SHA=${GIT_SHA}
39484049# Copy built application
4150COPY --from=build /app /app
···11import { Request, Response, NextFunction } from 'express';
22+import * as Sentry from '@sentry/node';
23import { ITokenService } from '../../../../modules/user/application/services/ITokenService';
34import { CookieService } from '../services/CookieService';
45···60616162 // Attach user DID to request for use in controllers
6263 req.did = didResult.value;
6464+6565+ // Set user context in Sentry for error tracking
6666+ Sentry.setUser({ id: didResult.value });
63676468 // Continue to the next middleware or controller
6569 next();
···9397 if (didResult.isOk() && didResult.value) {
9498 // Attach user DID to request for use in controllers
9599 req.did = didResult.value;
100100+101101+ // Set user context in Sentry for error tracking
102102+ Sentry.setUser({ id: didResult.value });
96103 }
9710498105 // Continue to the controller regardless of token validity
···132139 }
133140134141 req.did = didResult.value;
142142+143143+ // Set user context in Sentry for error tracking
144144+ Sentry.setUser({ id: didResult.value });
145145+135146 next();
136147 } catch (error) {
137148 res.status(500).json({ message: 'Authentication error' });
···168179 }
169180170181 req.did = didResult.value;
182182+183183+ // Set user context in Sentry for error tracking
184184+ Sentry.setUser({ id: didResult.value });
185185+171186 next();
172187 } catch (error) {
173188 res.status(500).json({ message: 'Authentication error' });