From 393623c4c069db48533afbe574465f35cce6931d Mon Sep 17 00:00:00 2001 From: austinkelsay Date: Fri, 8 Nov 2024 14:08:06 -0600 Subject: [PATCH] fix returning response --- src/pages/api/lightning-address/lnd.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/pages/api/lightning-address/lnd.js b/src/pages/api/lightning-address/lnd.js index 0e9e6c4..aae76c8 100644 --- a/src/pages/api/lightning-address/lnd.js +++ b/src/pages/api/lightning-address/lnd.js @@ -78,18 +78,16 @@ export default async function handler(req, res) { settled: false }, { ex: expiry || 86400 }); - // Trigger the polling endpoint - try { - await axios.get(`${BACKEND_URL}/api/invoices/short-poll`, { - headers: { - 'Authorization': PLEBDEVS_API_KEY - } - }); - } catch (error) { + // Trigger the polling endpoint without waiting for it + fetch(`${BACKEND_URL}/api/invoices/short-poll`, { + headers: { + 'Authorization': PLEBDEVS_API_KEY + } + }).catch(error => { console.error('Error triggering polling:', error); - // Continue even if polling fails - } + }); + // Return response immediately res.status(200).json({ invoice, payment_hash: paymentHashHex,