Skip to content

BUG] rootRequestHandler throws TypeError when payments are disabled and NIP-11 is requested #681

Description

@Priyanshubhartistm

Describe the bug

In src/handlers/request-handlers/root-request-handler.ts, the code unconditionally accesses settings.payments.feeSchedules:

fees: Object
  .getOwnPropertyNames(settings.payments.feeSchedules)  // ← TypeError if payments is undefined

When payments.enabled: false or the payments block is absent, this crashes the worker on any NIP-11 request.

To Reproduce

  1. Set payments.enabled: false in settings.yaml
  2. curl -H "Accept: application/nostr+json" http://localhost:8008/
  3. Worker crashes: TypeError: Cannot read properties of undefined (reading 'feeSchedules')

Fix

fees: settings.payments
  ? Object.getOwnPropertyNames(settings.payments.feeSchedules).reduce(...)
  : {},

System: Linux, Docker


Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions