Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLITE_CONSTRAINT when trying to create an invoice #14

Closed
aesedepece opened this issue Jan 21, 2018 · 2 comments
Closed

SQLITE_CONSTRAINT when trying to create an invoice #14

aesedepece opened this issue Jan 21, 2018 · 2 comments

Comments

@aesedepece
Copy link

aesedepece commented Jan 21, 2018

When trying to create an invoice through any of the POST /invoice examples in the README, I always get the same error:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Error: SQLITE_CONSTRAINT: NOT NULL constraint failed: invoice.rhash</pre>
</body>
</html>

charged daemon shows:

  lightning-client #1 --> invoice ["10000","8gcq7sOTkiqZiTODgfNZY","Lightning Charge Invoice",null] +17s
  lightning-client #1 <-- {"payment_hash":"42fa88fbe1f85516866a6fb4e4a0bcece294bca0428e947509305c6808317181","expiry_time":1516535310,"expires_at":1516535310,"bolt11":"lnbc100n1pdxgml7pp5gtag37lplp23dpn2d76wfg9uan3ff09qg28fgagfxpwxszp3wxqsdp8f35kw6r5de5kueeqgd5xzun8v5syjmnkda5kxegcqpggwmectjsfxeeuxwnpyccz8mhz2s7s5uv6kdzj3mnmq5ju0hctgmyyqrrrafmmma0sxuv2c9xvseg0cgxrvlmuf8fggh83hdjmsq32dgpr36dlj"} +40ms
  lightning-charge saving invoice: { id: '8gcq7sOTkiqZiTODgfNZY',
  description: undefined,
  metadata: undefined,
  msatoshi: '10000',
  quoted_currency: undefined,
  quoted_amount: undefined,
  rhash: undefined,
  payreq: 'lnbc100n1pdxgml7pp5gtag37lplp23dpn2d76wfg9uan3ff09qg28fgagfxpwxszp3wxqsdp8f35kw6r5de5kueeqgd5xzun8v5syjmnkda5kxegcqpggwmectjsfxeeuxwnpyccz8mhz2s7s5uv6kdzj3mnmq5ju0hctgmyyqrrrafmmma0sxuv2c9xvseg0cgxrvlmuf8fggh83hdjmsq32dgpr36dlj',
  expires_at: 1516535310,
  created_at: 1516531710,
  completed: false } +0ms
  knex:query insert into `invoice` (`completed`, `created_at`, `description`, `expires_at`, `id`, `metadata`, `msatoshi`, `payreq`, `quoted_amount`, `quoted_currency`, `rhash`) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +17s
  knex:bindings [ false,
  knex:bindings   1516531710,
  knex:bindings   null,
  knex:bindings   1516535310,
  knex:bindings   '8gcq7sOTkiqZiTODgfNZY',
  knex:bindings   'null',
  knex:bindings   '10000',
  knex:bindings   'lnbc100n1pdxgml7pp5gtag37lplp23dpn2d76wfg9uan3ff09qg28fgagfxpwxszp3wxqsdp8f35kw6r5de5kueeqgd5xzun8v5syjmnkda5kxegcqpggwmectjsfxeeuxwnpyccz8mhz2s7s5uv6kdzj3mnmq5ju0hctgmyyqrrrafmmma0sxuv2c9xvseg0cgxrvlmuf8fggh83hdjmsq32dgpr36dlj',
  knex:bindings   null,
  knex:bindings   null,
  knex:bindings   null ] +17s
POST /invoice 500 28.228 ms - 194
Error: SQLITE_CONSTRAINT: NOT NULL constraint failed: invoice.rhash

lightningd gets the request and creates the invoice, but charged doesn't seem to be mapping the response properly to its own invoice model.

@aesedepece
Copy link
Author

Ok, I had previously installed the beta3 release with npm and it was somehow shadowing the beta5 release I just installed with yarn.

Sorry for the hassle and kudos for the project 😁

@shesek
Copy link
Contributor

shesek commented Jan 21, 2018

Yes, that error was due to a version mismatch between c-lightning and lightning-charge. Using the latest versions of both should do the trick. Good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants