2 years ago
#65477
poncki
Status 500 when start Nuxt project by PM2
I have strange issue when I running Nuxt application by PM2 on nginx. When I start it by "pm2 start" application is working but I have Error 500 when I try to get data from database. When I start application just by "npm start" everything is working fine. I use "ecosystem.config.js":
module.exports = {
apps: [
{
name: 'MyAppName',
exec_mode: 'cluster',
instances: 'max',
script: './node_modules/nuxt/bin/nuxt.js',
args: 'start'
}
]
}
nginx setup (sites-available/default)
server {
listen 80;
listen [::]:80;
index index.html;
server_name my-domain.com www.my-domain.com;
location ~* ^.+\.(jpg|jpeg|png|gif)$ {
rewrite ^/_nuxt(/.*) $1 break;
root /var/www/myApplicationPath;
}
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
Request URL: http://my-domain.com/api/cars/?limit=5
The error:
{status: 500, message: "Cannot read properties of undefined (reading 'limit')", name: "TypeError"}
message: "Cannot read properties of undefined (reading 'limit')"
name: "TypeError"
status: 500
nginx
nuxt.js
pm2
0 Answers
Your Answer