Getting issues with service pm2

Hello!!

currently I have some issues when run pm2 start index.js in server

I get this issue:

/home/user/.pm2/pm2.log last 15 lines:
PM2        | 2024-04-15T18:26:06: PM2 log: App [Multiservice:0] exited with code [1] via signal [SIGINT]
PM2        | 2024-04-15T18:26:06: PM2 log: App [Multiservice:0] starting in -fork mode-
PM2        | 2024-04-15T18:26:06: PM2 log: App [Multiservice:0] online
PM2        | 2024-04-15T18:26:07: PM2 log: App [Multiservice:0] exited with code [1] via signal [SIGINT]
PM2        | 2024-04-15T18:26:07: PM2 log: App [Multiservice:0] starting in -fork mode-
PM2        | 2024-04-15T18:26:07: PM2 log: App [Multiservice:0] online
PM2        | 2024-04-15T18:26:07: PM2 log: App [Multiservice:0] exited with code [1] via signal [SIGINT]
PM2        | 2024-04-15T18:26:07: PM2 log: App [Multiservice:0] starting in -fork mode-
PM2        | 2024-04-15T18:26:07: PM2 log: App [Multiservice:0] online
PM2        | 2024-04-15T18:26:08: PM2 log: App [Multiservice:0] exited with code [1] via signal [SIGINT]
PM2        | 2024-04-15T18:26:08: PM2 log: App [Multiservice:0] starting in -fork mode-
PM2        | 2024-04-15T18:26:08: PM2 log: App [Multiservice:0] online
PM2        | 2024-04-15T18:26:09: PM2 log: App [Multiservice:0] exited with code [1] via signal [SIGINT]
PM2        | 2024-04-15T18:26:09: PM2 log: App [Multiservice:0] starting in -fork mode-
PM2        | 2024-04-15T18:26:09: PM2 log: App [Multiservice:0] online

/home/user/.pm2/logs/Multiservice.log last 15 lines:
/home/user/.pm2/logs/Multiservice.log last 15 lines:
0|Multiser |     at Module.require (node:internal/modules/cjs/loader:1100:19)
0|Multiser |     at Module.Hook._require.Module.require (/usr/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:101:39)
0|Multiser |     at require (node:internal/modules/cjs/helpers:119:18)
0|Multiser |     at Object.<anonymous> (/home/user/proyect/Multiservice/dist/app/server.js:18:13)
0|Multiser | ArgumentError: Must provide a domain
0|Multiser |     at new ManagementClient (/home/user/proyect/Multiservice/node_modules/auth0/src/management/index.js:120:13)
0|Multiser |     at Object.<anonymous> (/home/user/proyect/Multiservice/dist/utils/auth0.js:18:29)
0|Multiser |     at Module._compile (node:internal/modules/cjs/loader:1198:14)
0|Multiser |     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
0|Multiser |     at Module.load (node:internal/modules/cjs/loader:1076:32)
0|Multiser |     at Function.Module._load (node:internal/modules/cjs/loader:911:12)
0|Multiser |     at Module.require (node:internal/modules/cjs/loader:1100:19)
0|Multiser |     at Module.Hook._require.Module.require (/usr/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:101:39)
0|Multiser |     at require (node:internal/modules/cjs/helpers:119:18)
0|Multiser |     at Object.<anonymous> (/home/user/proyect/Multiservice/dist/app/server.js:18:13)

I have my own scripts for test my proyect, when I run npm run start (running build file) or npm run start:dev proyect run perfectly! , so this is ok!

but, if I tried to use pm2 run start index.js don’t work it, show errors

so what’s wrong?

on my file .env I push my variables enviroments: domain, client id, cliente secret, audience

Hi @adminsito

Welcome to the Auth0 Community!

Can you share the content of the auth0.js file?

Thanks
Dawid

Hello!

const  { ManagementClient } = require('auth0');
import { env } from "./enviroment";

export const auth0Config = {
    domain          :   env.AUTH0_DOMAIN,
    clientID        :   env.AUTH0_CLIENT_ID,
    clientSecret    :   env.AUTH0_CLIENT_SECRET,
    callbackURL     :   env.AUTH0_CALLBACK_URL, 
};

// Initialize Auth0 Management API client
export const auth0 = new ManagementClient({
    domain:         env.AUTH0_DOMAIN,
    clientId:       env.AUTH0_CLIENT_ID,
    clientSecret:   env.AUTH0_CLIENT_SECRET, 
});

export const auth0TokenScope = {
  client_id: env.AUTH0_CLIENT_ID,
  client_secret: env.AUTH0_CLIENT_SECRET,
  audience: env.AUTH0_AUDIENCE,
  grant_type: 'client_credentials',
};

export const urlTokenScope =  `https://${env.AUTH0_DOMAIN}/oauth/token`;

I’m working with auth0@3.7.1 because the version node in server is 16.15.0