diff --git a/Dockerfile b/Dockerfile index 0b396f1..aab3a99 100644 --- a/Dockerfile +++ b/Dockerfile @@ -46,13 +46,13 @@ ENV PORT=3000 ENV NODE_ENV=production # Copy standalone output and static files +# Create directory as root first, then copy with chown +RUN mkdir -p /app/.next/cache && chown -R nextjs:nodejs /app/.next/cache + COPY --from=builder --chown=nextjs:nodejs /app/public ./public COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static -# Ensure the cache directory specifically is writeable (Mintel Standard #16) -RUN mkdir -p .next/cache && chown -R nextjs:nodejs .next/cache - USER nextjs CMD ["node", "server.js"] diff --git a/lib/services/logging/pino-logger-service.ts b/lib/services/logging/pino-logger-service.ts index 30d4ac2..8f811d9 100644 --- a/lib/services/logging/pino-logger-service.ts +++ b/lib/services/logging/pino-logger-service.ts @@ -31,33 +31,51 @@ export class PinoLoggerService implements LoggerService { } trace(msg: string, ...args: unknown[]) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - this.logger.trace(msg, ...(args as any)); + if (args.length > 0 && typeof args[0] === "object" && args[0] !== null) { + (this.logger as any).trace(args[0] as object, msg, ...args.slice(1)); + } else { + (this.logger as any).trace(msg, ...args); + } } debug(msg: string, ...args: unknown[]) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - this.logger.debug(msg, ...(args as any)); + if (args.length > 0 && typeof args[0] === "object" && args[0] !== null) { + (this.logger as any).debug(args[0] as object, msg, ...args.slice(1)); + } else { + (this.logger as any).debug(msg, ...args); + } } info(msg: string, ...args: unknown[]) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - this.logger.info(msg, ...(args as any)); + if (args.length > 0 && typeof args[0] === "object" && args[0] !== null) { + (this.logger as any).info(args[0] as object, msg, ...args.slice(1)); + } else { + (this.logger as any).info(msg, ...args); + } } warn(msg: string, ...args: unknown[]) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - this.logger.warn(msg, ...(args as any)); + if (args.length > 0 && typeof args[0] === "object" && args[0] !== null) { + (this.logger as any).warn(args[0] as object, msg, ...args.slice(1)); + } else { + (this.logger as any).warn(msg, ...args); + } } error(msg: string, ...args: unknown[]) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - this.logger.error(msg, ...(args as any)); + if (args.length > 0 && typeof args[0] === "object" && args[0] !== null) { + (this.logger as any).error(args[0] as object, msg, ...args.slice(1)); + } else { + (this.logger as any).error(msg, ...args); + } } fatal(msg: string, ...args: unknown[]) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - this.logger.fatal(msg, ...(args as any)); + if (args.length > 0 && typeof args[0] === "object" && args[0] !== null) { + (this.logger as any).fatal(args[0] as object, msg, ...args.slice(1)); + } else { + (this.logger as any).fatal(msg, ...args); + } } child(bindings: Record): LoggerService { diff --git a/sentry.client.config.ts b/sentry.client.config.ts new file mode 100644 index 0000000..b071947 --- /dev/null +++ b/sentry.client.config.ts @@ -0,0 +1,13 @@ +import * as Sentry from "@sentry/nextjs"; +import { config } from "./lib/config"; + +if (config.errors.glitchtip.enabled) { + Sentry.init({ + dsn: config.errors.glitchtip.dsn, + tracesSampleRate: 1.0, + debug: config.isDevelopment, + environment: config.target || "production", + // Use the proxy path defined in config + tunnel: config.errors.glitchtip.proxyPath, + }); +} diff --git a/sentry.edge.config.ts b/sentry.edge.config.ts new file mode 100644 index 0000000..1d1ffaa --- /dev/null +++ b/sentry.edge.config.ts @@ -0,0 +1,11 @@ +import * as Sentry from "@sentry/nextjs"; +import { config } from "./lib/config"; + +if (config.errors.glitchtip.enabled) { + Sentry.init({ + dsn: config.errors.glitchtip.dsn, + tracesSampleRate: 1.0, + debug: config.isDevelopment, + environment: config.target || "production", + }); +} diff --git a/sentry.server.config.ts b/sentry.server.config.ts new file mode 100644 index 0000000..1d1ffaa --- /dev/null +++ b/sentry.server.config.ts @@ -0,0 +1,11 @@ +import * as Sentry from "@sentry/nextjs"; +import { config } from "./lib/config"; + +if (config.errors.glitchtip.enabled) { + Sentry.init({ + dsn: config.errors.glitchtip.dsn, + tracesSampleRate: 1.0, + debug: config.isDevelopment, + environment: config.target || "production", + }); +}