From 355839b36842371d3ea97d67328c3852b29c4274 Mon Sep 17 00:00:00 2001 From: Mike Talley Date: Wed, 28 Apr 2021 09:45:11 -0400 Subject: [PATCH 1/2] added endpoint and method to function context --- packages/serverless-dev-runtime/lib/data.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/serverless-dev-runtime/lib/data.js b/packages/serverless-dev-runtime/lib/data.js index b6f7e161e..0d2b1c20e 100644 --- a/packages/serverless-dev-runtime/lib/data.js +++ b/packages/serverless-dev-runtime/lib/data.js @@ -118,6 +118,8 @@ const getFunctionDataContext = async ( }, body: req.body, headers: getHeaders(req), + method: req.method, + endpoint: req.url, accountId: accountId || HUBSPOT_ACCOUNT_ID || MOCK_DATA.HUBSPOT_ACCOUNT_ID, contact: contact === 'true' || contact === true From 5a0a68a52fe3011b36a5bd0827b6c5aac13ddc53 Mon Sep 17 00:00:00 2001 From: Mike Talley Date: Wed, 28 Apr 2021 12:05:50 -0400 Subject: [PATCH 2/2] updated endpoint to match production value --- packages/serverless-dev-runtime/lib/data.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/serverless-dev-runtime/lib/data.js b/packages/serverless-dev-runtime/lib/data.js index 0d2b1c20e..52a3e0cfe 100644 --- a/packages/serverless-dev-runtime/lib/data.js +++ b/packages/serverless-dev-runtime/lib/data.js @@ -1,7 +1,7 @@ const fs = require('fs-extra'); const { logger } = require('@hubspot/cli-lib/logger'); const { getDotEnvData } = require('./secrets'); -const { MOCK_DATA, MAX_SECRETS } = require('./constants'); +const { MOCK_DATA, MAX_SECRETS, ROUTE_PATH_PREFIX } = require('./constants'); const getValidatedFunctionData = path => { // Allow passing serverless folder path with and without .functions extension @@ -119,7 +119,7 @@ const getFunctionDataContext = async ( body: req.body, headers: getHeaders(req), method: req.method, - endpoint: req.url, + endpoint: req.url.replace(`/${ROUTE_PATH_PREFIX}`, ''), accountId: accountId || HUBSPOT_ACCOUNT_ID || MOCK_DATA.HUBSPOT_ACCOUNT_ID, contact: contact === 'true' || contact === true