Strange behaviour using pm2 to start an application #4361
Replies: 1 comment 1 reply
-
|
Might be a bit to long, but i am facing a similar issue, did you succeed in solving the issue |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I hope someone can give me some light on this because it is a really weird behaviour happening here.
I have a repository composed of:
2 apps:
1 package: shared by both apps
In the production server, I only run the API and the API Library.
The API uses the API Library with some DTO objects that are used by class-transformer library to transform and serialize the data send on the endpoints.
Here is the pm2 ecosystem.config.js file:
When running the application with PM2, endpoints are sending empty responses, like if no DTOs were read from api-library package.
When running the application directly with turbo start --filter=api on the command line, it works.
Here is turbo.json:
{ "$schema": "https://turbo.build/schema.json", "pipeline": { "build": { "dependsOn": ["^build"], "outputs": ["dist/**"] }, "dashboard#build": { "dependsOn": ["^build"], "env": [ ... ], "outputs": [".next/**", "!.next/cache/**"] }, "lint": { "outputs": [] }, "dev": { "cache": false }, "start": { "dependsOn": ["^build"] } } }Here is package.json from api-library:
{ "name": "api-library", "version": "0.1.0", "main": "./dist/index.js", "types": "./dist/index.d.ts", "license": "UNLICENSED", "scripts": { "dev": "npm run build -- --watch", "build": "tsc", "lint": "eslint" }, "dependencies": { "class-transformer": "^0.5.1", "class-validator": "^0.14.0" }, "devDependencies": { "eslint-config-custom": "*", "tsconfig": "*", "typescript": "^5.0.2" } }Here is the package.json from api:
{ "name": "api", "version": "0.1.0", "license": "UNLICENSED", "scripts": { "dev": "nest start --watch", "build": "nest build", "start": "nest start", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", "start:prod": "node dist/main", ... }, "dependencies": { "api-library": "*", "class-transformer": "^0.5.1", "class-validator": "^0.14.0", ... }, "devDependencies": { "tsconfig": "*", "eslint-config-custom": "*", ... } }Beta Was this translation helpful? Give feedback.
All reactions