Strapi 5 TypeScript - Deployment with PM2

Hi Everyone

I’m facing a Issue with my Deployment on a Linux server with PM2.
I’m building my Strapi App with a gitlab Pipeline and rsync the neccessary Files to my Server.

When I want to start the App with pm2 start ecosystem.config.js, the service keeps on restarting until i stop the service.
This is my ecosystem.config.js

module.exports = {
apps: [
  {
    name: 'Production-API',
    exec_mode: 'cluster',
    instances: 1,
    script: 'npm',
    env: {
      PORT: '1337',
    },
    args: 'start',
  }
]
}

When I want to start the application directoly, with NPM RUN START I get this error:

> strapi start

Config file not loaded, extension must be one of .js,.json): admin.ts
Config file not loaded, extension must be one of .js,.json): api.ts
Config file not loaded, extension must be one of .js,.json): database.ts
Config file not loaded, extension must be one of .js,.json): middlewares.ts
Config file not loaded, extension must be one of .js,.json): plugins.ts
Config file not loaded, extension must be one of .js,.json): server.ts
[2024-10-18 18:05:04.416] error: Cannot destructure property 'client' of 'db.config.connection' as it is undefined.
TypeError: Cannot destructure property 'client' of 'db.config.connection' as it is undefined.

When I create a server.js and define the distDir, and start the app with node server.js it works

My server.js

const strapi = require('@strapi/strapi');
const app = strapi.createStrapi({ distDir: './dist' });
app.start();

Did anyone of you have a running deployment on a setup like mine? Or could help me with finding the Issue?
With Strapi 4 and the same setup (but without TypeScript) it works just fine.

This topic has been created from a Discord post (1296867389056487435) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord