From 13a16d71f821a02469affca7c13cbc2568b274f1 Mon Sep 17 00:00:00 2001 From: cpu Date: Fri, 28 Mar 2025 02:35:07 +0100 Subject: [PATCH] added debug for headers received --- README.md | 1 + server.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/README.md b/README.md index dcdae6c..ada6e5c 100644 --- a/README.md +++ b/README.md @@ -191,6 +191,7 @@ If you receive a different response, refer to the Troubleshooting section below. ## Troubleshooting * **Check Backend Logs:** `docker logs flic-webhook-webpush`. Look for errors related to configuration, file access, JSON parsing, authentication, or sending push notifications. + * The server logs all headers received from Flic requests to help with debugging. Look for lines starting with `DEBUG - All headers received:` to see all headers sent by the Flic button. * **Check Traefik Logs:** `docker logs traefik`. Look for routing errors or certificate issues. * **Verify `.env`:** Ensure all required variables are set correctly, especially VAPID keys and Traefik settings. * **Verify `labels`:** Double-check that variables were correctly substituted manually and match your `.env` and Traefik setup. diff --git a/server.js b/server.js index 1d94863..ae215d5 100644 --- a/server.js +++ b/server.js @@ -222,6 +222,12 @@ app.get('/flic-webhook', authenticateFlicRequest, async (req, res) => { // Get click_type from query parameter instead of request body const click_type = req.query.click_type; + // Debug: Log all headers received from Flic + console.log('DEBUG - All headers received:'); + Object.keys(req.headers).forEach(headerName => { + console.log(` ${headerName}: ${req.headers[headerName]}`); + }); + console.log(`Received GET webhook: Button=${buttonName}, Type=${click_type}, Timestamp=${timestamp || 'N/A'}`); // Basic validation