Skip to content

🐛 Bug Report: HTTP 500 error on all /v1/notifications GET requests #8789

@joshdk

Description

@joshdk

📜 Description

When triggering a workflow in the dashboard, the UI will spin for a few moments and then displays an error toast.

👟 Reproduction steps

For a minimal repro (that doesn't require triggering a workflow or even using the dashboard), you can simply curl the /v1/notifications endpoint:

curl -H "Authorization: ApiKey $NOVU_SECRET_KEY" 'http://localhost:3000/v1/notifications' 

Which results in a HTTP/1.1 500 Internal Server Error error with the following response body:

{
  "statusCode": 500,
  "timestamp": "2025-07-24T20:02:37.627Z",
  "path": "/v1/notifications",
  "message": "Internal server error, contact support and provide them with the errorId",
  "errorId": "4c1ec1de-09da-487a-a143-10febe5429ba"
}

Examining the logs of the api service, the following two lines are printed:

{
  "level": 50,
  "time": 1753387357627,
  "pid": 1,
  "serviceName": "@novu/api-service",
  "serviceVersion": "2.3.0",
  "platform": "Docker",
  "tenant": "OS",
  "req": {
    "id": 2023,
    "method": "GET",
    "url": "/v1/notifications",
    "query": {},
    "params": {
      "0": "v1/notifications"
    },
    "headers": {
      "host": "localhost:3000",
      "user-agent": "curl/8.6.0",
      "accept": "*/*"
    },
    "remoteAddress": "::ffff:127.0.0.1",
    "remotePort": 39184
  },
  "authScheme": "ApiKey",
  "err": {
    "type": "RangeError",
    "message": "Invalid time value",
    "stack": "RangeError: Invalid time value\n    at Date.toISOString (<anonymous>)\n    at /usr/src/app/apps/api/dist/app/notifications/usecases/get-activity-feed/get-activity-feed.usecase.js:253:59\n    at step (/usr/src/app/apps/api/dist/app/notifications/usecases/get-activity-feed/get-activity-feed.usecase.js:135:23)\n    at Object.next (/usr/src/app/apps/api/dist/app/notifications/usecases/get-activity-feed/get-activity-feed.usecase.js:76:20)\n    at asyncGeneratorStep (/usr/src/app/apps/api/dist/app/notifications/usecases/get-activity-feed/get-activity-feed.usecase.js:19:28)\n    at _next (/usr/src/app/apps/api/dist/app/notifications/usecases/get-activity-feed/get-activity-feed.usecase.js:37:17)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"
  },
  "error": {
    "statusCode": 500,
    "timestamp": "2025-07-24T20:02:37.627Z",
    "path": "/v1/notifications",
    "message": "Internal server error, contact support and provide them with the errorId",
    "errorId": "4c1ec1de-09da-487a-a143-10febe5429ba"
  },
  "msg": "Invalid time value"
}
{
  "level": 30,
  "time": 1753387357628,
  "pid": 1,
  "serviceName": "@novu/api-service",
  "serviceVersion": "2.3.0",
  "platform": "Docker",
  "tenant": "OS",
  "req": {
    "id": 2023,
    "method": "GET",
    "url": "/v1/notifications",
    "query": {},
    "params": {
      "0": "v1/notifications"
    },
    "headers": {
      "host": "localhost:3000",
      "user-agent": "curl/8.6.0",
      "accept": "*/*"
    },
    "remoteAddress": "::ffff:127.0.0.1",
    "remotePort": 39184
  },
  "authScheme": "ApiKey",
  "res": {
    "statusCode": 500,
    "headers": {
      "content-security-policy": "default-src 'self';base-uri 'self';font-src 'self' https: data:;form-action 'self';frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests",
      "cross-origin-embedder-policy": "require-corp",
      "cross-origin-opener-policy": "same-origin",
      "cross-origin-resource-policy": "same-origin",
      "x-dns-prefetch-control": "off",
      "x-frame-options": "SAMEORIGIN",
      "strict-transport-security": "max-age=15552000; includeSubDomains",
      "x-download-options": "noopen",
      "x-content-type-options": "nosniff",
      "origin-agent-cluster": "?1",
      "x-permitted-cross-domain-policies": "none",
      "referrer-policy": "no-referrer",
      "x-xss-protection": "0",
      "vary": "Origin, Accept-Encoding",
      "content-type": "application/json; charset=utf-8",
      "content-length": "218",
      "etag": "W/\"da-HQQFGo0Sw4fGwYOwjXzwcSrPg1w\""
    }
  },
  "err": {
    "type": "RangeError",
    "message": "Invalid time value",
    "stack": "RangeError: Invalid time value\n    at Date.toISOString (<anonymous>)\n    at /usr/src/app/apps/api/dist/app/notifications/usecases/get-activity-feed/get-activity-feed.usecase.js:253:59\n    at step (/usr/src/app/apps/api/dist/app/notifications/usecases/get-activity-feed/get-activity-feed.usecase.js:135:23)\n    at Object.next (/usr/src/app/apps/api/dist/app/notifications/usecases/get-activity-feed/get-activity-feed.usecase.js:76:20)\n    at asyncGeneratorStep (/usr/src/app/apps/api/dist/app/notifications/usecases/get-activity-feed/get-activity-feed.usecase.js:19:28)\n    at _next (/usr/src/app/apps/api/dist/app/notifications/usecases/get-activity-feed/get-activity-feed.usecase.js:37:17)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"
  },
  "responseTime": 18,
  "msg": "request errored"
}

Reformatting the error a bit results in this stacktrace:

RangeError: Invalid time value
    at Date.toISOString (<anonymous>)
    at /usr/src/app/apps/api/dist/app/notifications/usecases/get-activity-feed/get-activity-feed.usecase.js:253:59
    at step (/usr/src/app/apps/api/dist/app/notifications/usecases/get-activity-feed/get-activity-feed.usecase.js:135:23)
    at Object.next (/usr/src/app/apps/api/dist/app/notifications/usecases/get-activity-feed/get-activity-feed.usecase.js:76:20)
    at asyncGeneratorStep (/usr/src/app/apps/api/dist/app/notifications/usecases/get-activity-feed/get-activity-feed.usecase.js:19:28)
    at _next (/usr/src/app/apps/api/dist/app/notifications/usecases/get-activity-feed/get-activity-feed.usecase.js:37:17)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)q

👍 Expected behavior

The /v1/notifications endpoint should properly return notifications and not result in an internal stacktrace.

👎 Actual Behavior with Screenshots

Behavior can be observed in the dashboard UI by creating any workflow (the error appears identically on all workflows) and then triggering it.

Image

Thankfully, you can see that an in-app notification was correctly sent (email are also correctly sent if the workflow is configured to do so), but the error toast still appears.

Image

Opening up devtools, you can see repeated calls to the /v1/notifications endpoint, each resulting in an HTTP 500.

Image

Novu version

2.3.0

npm version

10.8.2

node version

v20.18.1

📃 Provide any additional context for the Bug.

We are self-hosting Novu internally (IS_SELF_HOSTED=true/VITE_SELF_HOSTED=true) and recently upgraded to the 2.3.0 release.

👀 Have you spent some time to check if this bug has been raised before?

  • I checked and didn't find a similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to submit PR?

None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions