All lessons · CKB node, RPC and indexer · Start here · Glossary
CKB log subscription notifications may carry params.result as a JSON stringWorkingFrom one fix
From one fix · Check: right · Checked 2026-11-19
When subscribing to the CKB node's "log" topic over the TCP subscription RPC, the notification's params.result can be a JSON-encoded string of the log entry (message, level, target, date) rather than an object. Parse it with JSON.parse when it is a string, and skip malformed payloads instead of stopping the stream; otherwise script debug output (target ckb_script::verify) is silently dropped.
Why it matters: A client that only accepts an object in params.result discards every log notification CKB sends as a JSON string, so script debug output from ckb_script::verify never reaches the developer.
Pattern
if (typeof result === 'string') { try { result = JSON.parse(result); } catch { return null; } }Taken from the commit, shortened.
A test changed in the same commit
It sits next to the fix. We did not run it.
- ckb-devrel/offckb:
tests/cli-startup.test.ts,tests/log-subscription.test.ts
- Concepts
- Network and RPC reliability, Testing and devnet
- Evidence
- From one fix: from one project, checked against its commit
- First seen
- 2026-11-09
- Last changed
- 2026-11-09
- Last checked
- 2026-11-19
- Check against the commit
- right: the lesson follows from its commit and still holds in the code today
Sources (1)
- 2026-11-09 · ckb-devrel/offckb · more from this project
More about CKB node, RPC and indexer
- get_transaction returns an object with a null transaction for rejected and unknown txs
- Simulating a real CKB reorg with two devnet nodes over P2P
- Wait for tx_pool_info tip to match chain tip before submitting on devnet
Do you maintain a project this lesson came from? Confirm or correct it
Cite this lesson
LusoCryptoLabs, "CKB log subscription notifications may carry params.result as a JSON string", CKB lessons, https://pulse.lusocryptolabs.com/learned/node/ckb-log-subscription-notifications-may-carry-params-result-a, CC BY 4.0, last changed 2026-11-09.