1

I am very close to release and while I was testing, I realized my api restarts on image upload, giving me 502 error.

I realized pm2 was restarting on image upload endpoint - since it is not logging any error on api side, it must have been server itself.

while investigating, I realized i had watch option to be true, so I set it to false and expecting all things to work again.

  "apps": [
    {
      "name": "app",
      "script": "src/index.js",
      "instances": 1,
      "autorestart": true,
      "watch": false,
      "time": true,
      "env": {
        "NODE_ENV": "production"
      }
    }
  ]
}

this is my ecosystem.config.json and my pm2 command is pm2 start ecosystem.config.json --no-daemon

well, pm2 still restarting on every image upload endpoint, giving me same error 502.

I am not physically storing images on my server, i simply save images to s3 buckets.. so image upload file change must be some kind of temp file... can anyone guide me to the right direction?

Thank you.

edit:

Just figured out this silent crash only happens in docker container.. feature works fine when server was ran locally. Still trying to debug it. Also could possibly be sharp image resizing crashing... unsure..

tried sharp.concurrency(1); sharp.cache(false); and setting UV_THREADPOOL_SIZE=1 but no luck

Damian
  • 934
  • 8
  • 12

1 Answers1

0

Fixed.

those who are having similar issue.

problem was actually on sharp image resizing library.

the older version library was not compatible with node:alpine.

updating the library to the latest one fixed the problem and the container does not crash anymore.

Damian
  • 934
  • 8
  • 12