spliit-app / spliit

Free and Open Source Alternative to Splitwise. Share expenses with your friends and family.
https://spliit.app
MIT License
1.16k stars 184 forks source link

uptime-kuma: Spliit return Internal Server Error 500 #221

Open camrossi opened 2 months ago

camrossi commented 2 months ago

I am using uptime-kuma to monitor a few of my apps and spliit 1.9 always returns a 500 error. This happens also if I use curl or wget against my spliit instance.

The logs of the spliit container contains this error:

Error: Cannot find module './undefined.json'
    at /usr/app/.next/server/chunks/2221.js:1:198
    at async /usr/app/.next/server/chunks/2221.js:1:19477
    at async /usr/app/.next/server/chunks/3166.js:148:9351
    at async /usr/app/.next/server/chunks/3166.js:148:9816
    at async /usr/app/.next/server/chunks/3166.js:148:10005
    at async X (/usr/app/.next/server/chunks/2221.js:1:17582) {
  code: 'MODULE_NOT_FOUND',
  digest: '1972969468'
}

This happens only with kuma/curl/wget but a browser works just fine so I guess there is something with the request headers perhaps.

Not really a big issue for now I accept 500 as a success

Thanks !

CypressXt commented 1 month ago

Hey, I've noticed the same issue on my side as well. You're right it can be fixed by adding the (apparently required) Accept-Language header:

Header in curl:

curl -v https://your.spliit.instance.tld -H 'Accept-Language: en-US'
[...]
< HTTP/2 200 
< server: nginx

Header in uptime-kuma:

{
    "Accept-Language": "en-US"
}
ChristopherJohnston commented 1 month ago

probably due to the addition of i18n modules

dixneuf19 commented 2 weeks ago

Hi,

Also impacted by this bug on my self hosted Kubernetes deployment. After an upgrade from 1.8.1 to 1.14.1 the pod started failing to be Running since the Startup/Readiness/Liveness Probe I set up on the / endpoint were failing because they did not use this header.

NAME                      READY   STATUS    RESTARTS      AGE
spliit-5648b49c6b-tdm77   0/1     Running   2 (87s ago)   11m  <-- never Ready since the probe fails
# ... old versions are OK

I had the same log as above

❯ kl spliit-5648b49c6b-tdm77 
Setting timezone to UTC...
Waiting 60s for database to be ready...
PostgreSQL database ready!
Prisma migrate and deploy...
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "spliit", schema "public" at "spliit-postgresql:5432"

19 migrations found in prisma/migrations

No pending migrations to apply.

> spliit2@0.1.0 start
> next start

  ▲ Next.js 14.2.5
  - Local:        http://localhost:3000

 ✓ Starting...
 ✓ Ready in 1946ms
Error: Cannot find module './undefined.json'
    at /usr/app/.next/server/chunks/3215.js:1:443
    at async /usr/app/.next/server/chunks/3215.js:1:20983
    at async /usr/app/.next/server/chunks/9013.js:148:9245
    at async /usr/app/.next/server/chunks/9013.js:148:9710 {
  code: 'MODULE_NOT_FOUND',
  digest: '3224353063'
}
Error: Cannot find module './undefined.json'
...

I fixed it by adding this header to my probe (see fix)

          livenessProbe:
            httpGet:
              path: /
              port: http
              httpHeaders:
              - name: Accept-Language
                value: en-US
          readinessProbe:
            httpGet:
             path: /
             port: http
             httpHeaders:
             - name: Accept-Language
               value: en-US
          startupProbe:
            httpGet:
              path: /
              port: http
              httpHeaders:
              - name: Accept-Language
                value: en-US

I don't think this behavior is wanted, but maybe I should use another endpoint for healhtcheck. I see two paths forward:

Thanks for this great project!