π A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!
Vue awesomedashboarddockerhomelabhomepagemitnodejsorganizationproductivitypwaself-hostedstartpagevue
π Fixes the Netlify serverless functions for Node 24+
Alicia Sykes627cdae34e1e
diff --git a/services/serverless-functions/cloud-status-check.js b/services/serverless-functions/cloud-status-check.jsindex be177396..192a946e 100644--- a/services/serverless-functions/cloud-status-check.js+++ b/services/serverless-functions/cloud-status-check.js@@ -1,12 +1,15 @@/* A cloud function that wraps the status checking method, for use on Netlify */const statusCheck = require('../endpoints/status-check');-exports.handler = (event, context, callback) => {- const paramStr = event.rawQuery;- statusCheck(paramStr, (results) => {- callback(null, {- statusCode: 200,- body: results,- });- });+exports.handler = async (event) => {+ try {+ const body = await new Promise((resolve) => { statusCheck(event.rawQuery, resolve); });+ return { statusCode: 200, headers: { 'Content-Type': 'application/json' }, body };+ } catch {+ return {+ statusCode: 500,+ headers: { 'Content-Type': 'application/json' },+ body: JSON.stringify({ successStatus: false, message: 'β Status check failed badly' }),+ };+ }};diff --git a/services/serverless-functions/netlify-cors.js b/services/serverless-functions/netlify-cors.jsindex 733408fa..0dc5ac63 100644--- a/services/serverless-functions/netlify-cors.js+++ b/services/serverless-functions/netlify-cors.js@@ -1,28 +1,26 @@/* A Netlify cloud function to handle requests to CORS-disabled services */const request = require('../utils/request');-exports.handler = (event, context, callback) => {+const { validateTargetUrl } = request;++exports.handler = async (event) => {// Get input dataconst { body, headers, queryStringParameters } = event;// Get URL from header or GET param- const requestUrl = queryStringParameters.url || headers['Target-URL'] || headers['target-url'];+ const requestUrl = queryStringParameters?.url || headers['Target-URL'] || headers['target-url'];- const returnError = (msg, error) => {- callback(null, {- statusCode: 400,- body: JSON.stringify({ success: false, msg, error }),- });- };+ const returnError = (msg, error) => ({+ statusCode: 400,+ body: JSON.stringify({ success: false, msg, error }),+ });// If URL missing, return error- if (!requestUrl) {- returnError('Missing Target-URL header', null);- }+ if (!requestUrl) return returnError('Missing Target-URL header', null);- let custom = {};+ let custom;try {custom = JSON.parse(headers.CustomHeaders || headers.customheaders || '{}');- } catch (e) { returnError('Unable to parse custom headers'); }+ } catch { return returnError('Unable to parse custom headers'); }// Response headersconst requestHeaders = {@@ -36,13 +34,16 @@ exports.handler = (event, context, callback) => {url: requestUrl,data: body,headers: requestHeaders,+ validateUrl: validateTargetUrl,+ timeout: 30000,+ maxResponseSize: 10 * 1024 * 1024, // 10 MB};// Make request- request(requestConfig)- .then((response) => {- callback(null, { statusCode: 200, body: JSON.stringify(response.data) });- }).catch((error) => {- returnError('Request failed', error);- });+ try {+ const response = await request(requestConfig);+ return { statusCode: 200, body: JSON.stringify(response.data) };+ } catch (error) {+ return returnError('Request failed', error);+ }};