env
All checks were successful
Build & Deploy KLZ Cables / build-and-deploy (push) Successful in 3m52s

This commit is contained in:
2026-01-27 23:51:48 +01:00
parent 5a5c10ca36
commit cbca29cbcf
3 changed files with 15 additions and 7 deletions

4
.env
View File

@@ -2,6 +2,10 @@
NODE_ENV=production NODE_ENV=production
NEXT_PUBLIC_BASE_URL=https://klz-cables.com NEXT_PUBLIC_BASE_URL=https://klz-cables.com
LOG_LEVEL=info LOG_LEVEL=info
PDF_DEBUG_EXCEL=0
PDF_LOCALE=
PDF_MATCH=
PDF_LIMIT=0
# WooCommerce & WordPress # WooCommerce & WordPress
WOOCOMMERCE_URL=https://klz-cables.com WOOCOMMERCE_URL=https://klz-cables.com

View File

@@ -1,5 +1,4 @@
import * as Sentry from '@sentry/nextjs'; import * as Sentry from '@sentry/nextjs';
import { getServerAppServices } from '@/lib/services/create-services.server';
/** /**
* Next.js will call this on boot for the active runtime. * Next.js will call this on boot for the active runtime.
@@ -9,13 +8,13 @@ import { getServerAppServices } from '@/lib/services/create-services.server';
* - 'edge' when running in the Edge runtime (e.g. Middleware, Edge API Routes) * - 'edge' when running in the Edge runtime (e.g. Middleware, Edge API Routes)
*/ */
export async function register() { export async function register() {
// Initialize server services on boot
if (process.env.NEXT_RUNTIME === 'nodejs') {
getServerAppServices();
}
if (process.env.NEXT_RUNTIME === 'nodejs') { if (process.env.NEXT_RUNTIME === 'nodejs') {
await import('./sentry.server.config'); await import('./sentry.server.config');
// Initialize server services on boot
// We do this AFTER Sentry to ensure errors during service init are caught
const { getServerAppServices } = await import('@/lib/services/create-services.server');
getServerAppServices();
} }
if (process.env.NEXT_RUNTIME === 'edge') { if (process.env.NEXT_RUNTIME === 'edge') {

View File

@@ -9,11 +9,16 @@ export class PinoLoggerService implements LoggerService {
if (parent) { if (parent) {
this.logger = parent.child({ name }); this.logger = parent.child({ name });
} else { } else {
// In Next.js, especially in the Edge runtime or during instrumentation,
// pino transports (which use worker threads) can cause issues.
// We disable transport in production and during instrumentation.
const useTransport = !config.isProduction && typeof window === 'undefined';
this.logger = pino({ this.logger = pino({
name: name || 'app', name: name || 'app',
level: config.logging.level, level: config.logging.level,
transport: transport:
!config.isProduction useTransport
? { ? {
target: 'pino-pretty', target: 'pino-pretty',
options: { options: {