SSR failing because is looking for .json translation files instead of .json5

19 views
Skip to first unread message

Gonzalo Cao Cabeza de Vaca

unread,
Jul 31, 2025, 7:17:51 AM7/31/25
to DSpace Technical Support
Hi all, 
We are experiencing an issue with Server-Side Rendering (SSR) in our new DSpace 7.6.1 deployment.  The frontend was built using yarn build:prod and is served with PM2 in cluster mode, proxied by Apache ( standard procedure).

While the application generally works, SSR fails and falls back to client-side rendering. The PM2 logs show the following persistent error:

2025-07-30 12:24:27 +02:00: Error in server-side rendering (SSR)
2025-07-30 12:24:27 +02:00: Error details :  Error: ENOENT: no such file or directory, open 'dist/server/assets/i18n/en.json'
    at Object.openSync (node:fs:601:3)
    at readFileSync (node:fs:469:35)
    at TranslateServerLoader.getTranslation (/xxxxxxxx/dspace-angular/dist/server/main.js:1:7841654)
    at TranslateService.getTranslation (/xxxxxxxx/dspace-angular/dist/server/main.js:1:2544266)
    at TranslateService.retrieveTranslations (/xxxxxxxx/dspace-angular/dist/server/main.js:1:2544114)
    at TranslateService.use (/xxxxxxxxx/dspace-angular/dist/server/main.js:1:2543648)
    at ServerLocaleService.setCurrentLanguageCode (/xxxxxxxxx/dspace-angular/dist/server/main.js:1:803671)
    at ServerInitService.initI18n (/xxxxxxxxxx/dspace-angular/dist/server/main.js:1:7852325)
    at ServerInitService.<anonymous> (/xxxxxxxxx/dspace-angular/dist/server/main.js:1:7854044)
    at Generator.next (<anonymous>) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: 'dist/server/assets/i18n/en.json'
}
2025-07-30 12:24:27 +02:00: Falling back to serving direct client-side rendering (CSR).

I've checked the path dspace-angular/dist/server/assets/i18n/, and the error is correct: the file en.json doesn't exist. Instead, the build process has generated files with hashes for cache-busting, like:
  • en.d332cb3fe482394367781784743548fd.json

  • en.json5

It seems the server-side application is hardcoded to look for en.json, but the build process creates a hashed version.

Has anyone encountered this mismatch? Is there a specific configuration in angular, PM2 or config.prod.yml that I need to adjust to make SSR correctly resolve the paths to these hashed asset files?

I haven't found any clues about this specific pathing issue online. Any pointers would be greatly appreciated.

Regards.

Reply all
Reply to author
Forward
0 new messages