Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

[BUG] LNbits >= 1.0: ISO 8601 time/expiry parsed as unix seconds, paid admissions never confirmed

已關閉
#927 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

已經有一個關聯 PR 被合併了。

  • #943 來自 @chappie-daemon —— 已合併

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
25/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
停滯
技術堆疊
typescript
領域
backend, payments

研究方向

Start with LNbitsPaymentsProcessor.getInvoice() and trace how details.time and details.expiry become invoice dates. Check the processor’s unit tests for numeric and ISO 8601 responses; done means paid invoices confirm and expired invoices retire for both formats. The issue author says a fix and tests are ready and plans to open a pull request.

由索引模型根據 Issue 內容生成。

描述

Describe the bug
With LNbits >= 1.0 as the payments processor, paid admissions are never confirmed and expired invoices stay pending forever.

LNbits 1.x returns details.time and details.expiry from GET /api/v1/payments/{payment_hash} as ISO 8601 strings (e.g. "2025-10-11T15:24:27+00:00"); LNbits 0.x returned unix seconds. LNbitsPaymentsProcessor still does new Date(data.details.time * 1000) / new Date(data.details.expiry * 1000), which yields Invalid Date for strings. As a result:

  • PaymentsService.confirmInvoice → InvoiceRepository.confirmInvoice calls confirmedAt.toISOString() → RangeError: Invalid time value, so a user who paid the admission invoice is not admitted (both from the /callbacks/lnbits webhook and from the maintenance worker poll);
  • isExpiredInvoice() is false for an invalid expiresAt, so unpaid invoices that LNbits still knows are re-saved as pending on every maintenance pass and never retired.

To Reproduce

  1. Run nostream with payments.enabled: true, payments.processor: lnbits against LNbits 1.x (seen with 1.5.6).
  2. Request an admission invoice at /invoices and pay it.
  3. The invoice is not confirmed and the pubkey is not admitted; unpaid invoices past their expiry remain pending in the invoices table.

Unit-level reproduction: feed invoiceResponse({ data: { paid: true }, details: { time: '2025-10-11T15:24:27+00:00' } }) to LNbitsPaymentsProcessor.getInvoice() — confirmedAt is Invalid Date.

Expected behavior
Dates from LNbits are parsed correctly whether they come as unix seconds (LNbits < 1.0) or ISO 8601 strings (LNbits >= 1.0); paid invoices get confirmed, expired ones get retired.

System

  • OS: Ubuntu 22.04
  • Platform: docker (compose)
  • Version: nostream 3.4.1 (same code in 2.1.0 and current main); LNbits 1.5.6

Logs
On 3.4.1 after the upgrade, 15 old unpaid invoices that LNbits still knows were re-saved as pending every minute; with the fix applied they were retired as expired on the next maintenance pass.

Additional context
I have a small fix with unit tests ready (accept both a number and an ISO string in the LNbits processor) and will open a PR referencing this issue.

主要語言
TypeScript
星號
829
分支
234
平均合併
16 小時 57 分鐘
30 天內合併 PR
76

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

cameri/nostream 的其他 Issue

查看 cameri/nostream 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。