From 09a87eda1407d47d53ce19f216c6a96f73054896 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Feb 2026 17:26:47 +0000 Subject: [PATCH 1/2] Initial plan From 56e343dc0129f1352c4fa092be6d773d3c05afd0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Feb 2026 17:30:20 +0000 Subject: [PATCH 2/2] Add production KV store check to Lightning verification endpoints Co-authored-by: spe1020 <140115230+spe1020@users.noreply.github.com> --- .../api/genesis/verify-lightning-payment/+server.ts | 10 ++++++++++ .../api/membership/verify-lightning-payment/+server.ts | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/routes/api/genesis/verify-lightning-payment/+server.ts b/src/routes/api/genesis/verify-lightning-payment/+server.ts index 696cdee..fcd7e12 100644 --- a/src/routes/api/genesis/verify-lightning-payment/+server.ts +++ b/src/routes/api/genesis/verify-lightning-payment/+server.ts @@ -49,6 +49,16 @@ export const POST: RequestHandler = async ({ request, platform }) => { // Look up stored metadata to verify the request const kv = platform?.env?.GATED_CONTENT ?? null; + if (!kv && env.NODE_ENV === 'production') { + console.error('[Genesis Lightning] GATED_CONTENT KV binding is missing in production environment'); + return json( + { + error: 'Service unavailable', + message: 'GATED_CONTENT KV namespace is not configured' + }, + { status: 503 } + ); + } const metadata = receiveRequestId ? await getInvoiceMetadata(kv, receiveRequestId) : await getInvoiceMetadataByPaymentHash(kv, paymentHash); diff --git a/src/routes/api/membership/verify-lightning-payment/+server.ts b/src/routes/api/membership/verify-lightning-payment/+server.ts index 4cd6ab6..e6ed5ba 100644 --- a/src/routes/api/membership/verify-lightning-payment/+server.ts +++ b/src/routes/api/membership/verify-lightning-payment/+server.ts @@ -71,6 +71,16 @@ export const POST: RequestHandler = async ({ request, platform }) => { // Look up stored metadata to verify the request matches what was created const kv = platform?.env?.GATED_CONTENT ?? null; + if (!kv && env.NODE_ENV === 'production') { + console.error('[Verify Lightning] GATED_CONTENT KV binding is missing in production environment'); + return json( + { + error: 'Service unavailable', + message: 'GATED_CONTENT KV namespace is not configured' + }, + { status: 503 } + ); + } const metadata = receiveRequestId ? await getInvoiceMetadata(kv, receiveRequestId) : await getInvoiceMetadataByPaymentHash(kv, paymentHash);