<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: HubSpot UI Extension | Serverless Function Fails to Find Local Module After Deployment in HubSpo in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/HubSpot-UI-Extension-Serverless-Function-Fails-to-Find-Local/m-p/1043066#M40705</link>
    <description>&lt;P&gt;Hi, Thanks for your response,&lt;/P&gt;
&lt;P&gt;I Already tried all of them, none of them will work!&lt;/P&gt;</description>
    <pubDate>Thu, 19 Sep 2024 09:03:15 GMT</pubDate>
    <dc:creator>MAsghari</dc:creator>
    <dc:date>2024-09-19T09:03:15Z</dc:date>
    <item>
      <title>HubSpot UI Extension | Serverless Function Fails to Find Local Module After Deployment in HubSpot UI</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubSpot-UI-Extension-Serverless-Function-Fails-to-Find-Local/m-p/1042532#M40699</link>
      <description>&lt;P&gt;Hi There,&lt;/P&gt;
&lt;P&gt;I'm deploying a custom UI Extension in HubSpot that includes serverless functions. Locally, everything works fine, but once I deploy, I encounter the following error:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{
    "status": "error",
    "message": "The serverless function 'handle-report' failed to execute: Cannot find module './services/handle-report-service'\nRequire stack:\n- /var/task/test.js\n- /var/task/hubspotHandler.js\n- /var/runtime/index.mjs."
}
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm attempting to require a local module from in 'handle-report' which is a serverless function:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;// Services
const HandleReportService = require('./services/handle-report-service');

exports.main = async (context = {}) =&amp;gt; {
  -----
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In &lt;STRONG&gt;local development&lt;/STRONG&gt;, this works perfectly, and the module is found as expected. However, once the extension is deployed in the HubSpot environment, using 'hs project upload' the serverless function fails with a "Cannot find module" error.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3&gt;What I've Tried:&lt;/H3&gt;
&lt;OL&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Using Relative Paths&lt;/STRONG&gt; (&lt;CODE&gt;./services/handle-report-service&lt;/CODE&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Using &lt;CODE&gt;path.join()&lt;/CODE&gt; and &lt;CODE&gt;path.resolve()&lt;/CODE&gt;&lt;/STRONG&gt; with &lt;CODE&gt;__dirname&lt;/CODE&gt;:&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Testing &lt;CODE&gt;process.cwd()&lt;/CODE&gt;&lt;/STRONG&gt;:&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Double-checking the folder structure&lt;/STRONG&gt;:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The &lt;CODE&gt;services/handle-report-service.js&lt;/CODE&gt; file is present locally and is deployed as part of the extension.&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Checking deployment settings and logs&lt;/STRONG&gt;:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;I reviewed the deployment logs, but nothing indicates why this file isn't being found.&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;Can you help me to understand the problem?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2024 10:34:19 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubSpot-UI-Extension-Serverless-Function-Fails-to-Find-Local/m-p/1042532#M40699</guid>
      <dc:creator>MAsghari</dc:creator>
      <dc:date>2024-09-18T10:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: HubSpot UI Extension | Serverless Function Fails to Find Local Module After Deployment in HubSpo</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubSpot-UI-Extension-Serverless-Function-Fails-to-Find-Local/m-p/1042565#M40700</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/349163"&gt;@MAsghari&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The issue likely stems from how HubSpot handles paths in the serverless environment after deployment. In a serverless setup, the directory structure may differ from local development, so relative paths don't always behave as expected.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Here’s what you can do:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;1. Check that the filename and the import path match exactly, including case sensitivity. Serverless environments may be stricter about this than local ones.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;2. Try switching from relative paths (./services/handle-report-service) to absolute paths by using path.resolve() to ensure the correct module path:&lt;BR /&gt;&lt;BR /&gt;const path = require('path');&lt;BR /&gt;const HandleReportService = require(path.resolve(__dirname, './services/handle-report-service'));&lt;BR /&gt;&lt;BR /&gt;3.&amp;nbsp;Verify that the services/handle-report-service.js file is included in the build when you deploy the project using hs project upload. Sometimes, files may not be uploaded if excluded in deployment settings.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;4. If the issue persists, try cleaning the project (delete build artifacts) and re-deploying it using hs project upload.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;This should help resolve the path issue in the serverless environment.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope it helps, let me know if you need to&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://calendly.com/khushboo-pokhriyal/30min?month=2024-08" target="_blank" rel="noopener nofollow noreferrer"&gt;talk&lt;/A&gt;!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Khushboo Pokhriyal&lt;/P&gt;&lt;P&gt;Growth &amp;amp; Operations&lt;/P&gt;&lt;P&gt;GroRapid Labs&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.linkedin.com/in/khushboopokhriyal" target="_blank" rel="noopener nofollow noreferrer"&gt;LinkedIn |&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/A&gt;&lt;A href="tel:9315044754" target="_blank" rel="noopener nofollow noreferrer"&gt;9315044754 |&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/A&gt;&lt;A href="mailto:khushboo.pokhriyal@grorapid.com" target="_blank" rel="noopener nofollow noreferrer"&gt;Email |&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/A&gt;&lt;A href="https://www.grorapidlabs.com/" target="_blank" rel="noopener nofollow noreferrer"&gt;Website&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2024 11:53:01 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubSpot-UI-Extension-Serverless-Function-Fails-to-Find-Local/m-p/1042565#M40700</guid>
      <dc:creator>KhushbooP11</dc:creator>
      <dc:date>2024-09-18T11:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: HubSpot UI Extension | Serverless Function Fails to Find Local Module After Deployment in HubSpo</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubSpot-UI-Extension-Serverless-Function-Fails-to-Find-Local/m-p/1043066#M40705</link>
      <description>&lt;P&gt;Hi, Thanks for your response,&lt;/P&gt;
&lt;P&gt;I Already tried all of them, none of them will work!&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 09:03:15 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubSpot-UI-Extension-Serverless-Function-Fails-to-Find-Local/m-p/1043066#M40705</guid>
      <dc:creator>MAsghari</dc:creator>
      <dc:date>2024-09-19T09:03:15Z</dc:date>
    </item>
    <item>
      <title>Re: HubSpot UI Extension | Serverless Function Fails to Find Local Module After Deployment in HubSpo</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubSpot-UI-Extension-Serverless-Function-Fails-to-Find-Local/m-p/1050103#M40861</link>
      <description>&lt;P&gt;Hi There!&lt;/P&gt;
&lt;P&gt;Any feedback/solution for&amp;nbsp; this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2024 09:06:16 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubSpot-UI-Extension-Serverless-Function-Fails-to-Find-Local/m-p/1050103#M40861</guid>
      <dc:creator>MAsghari</dc:creator>
      <dc:date>2024-10-04T09:06:16Z</dc:date>
    </item>
    <item>
      <title>Re: HubSpot UI Extension | Serverless Function Fails to Find Local Module After Deployment in HubSpo</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubSpot-UI-Extension-Serverless-Function-Fails-to-Find-Local/m-p/1052769#M40930</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/169781"&gt;@kennedyp&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please check this question and send it to one your specialist to check!&lt;/P&gt;
&lt;P&gt;I'd appreciate if&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/324811"&gt;@zach_threadint&lt;/a&gt;&amp;nbsp;can take a look at this!&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2024 08:07:15 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubSpot-UI-Extension-Serverless-Function-Fails-to-Find-Local/m-p/1052769#M40930</guid>
      <dc:creator>MAsghari</dc:creator>
      <dc:date>2024-10-10T08:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: HubSpot UI Extension | Serverless Function Fails to Find Local Module After Deployment in HubSpo</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubSpot-UI-Extension-Serverless-Function-Fails-to-Find-Local/m-p/1056100#M41001</link>
      <description>&lt;P&gt;Thanks for the tag, &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/349163"&gt;@MAsghari&lt;/a&gt;! I want to invite some subject matter experts to see if they have any suggestions.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Hey &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/123775"&gt;@danmoyle&lt;/a&gt;, &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/9259"&gt;@Mike_Eastwood&lt;/a&gt;&amp;nbsp;, &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/101258"&gt;@Teun&lt;/a&gt;&amp;nbsp;do you have any thoughts on this?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2024 21:16:01 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubSpot-UI-Extension-Serverless-Function-Fails-to-Find-Local/m-p/1056100#M41001</guid>
      <dc:creator>kennedyp</dc:creator>
      <dc:date>2024-10-16T21:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: HubSpot UI Extension | Serverless Function Fails to Find Local Module After Deployment in HubSpo</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubSpot-UI-Extension-Serverless-Function-Fails-to-Find-Local/m-p/1074704#M41394</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/169781"&gt;@kennedyp&lt;/a&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;Can you please check if anyone has an answer for this? I keep receiving this error for multiple projects and have no idea how to fix it. The provide answers up to now are not correct!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2024 14:33:14 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubSpot-UI-Extension-Serverless-Function-Fails-to-Find-Local/m-p/1074704#M41394</guid>
      <dc:creator>MAsghari</dc:creator>
      <dc:date>2024-11-25T14:33:14Z</dc:date>
    </item>
    <item>
      <title>Re: HubSpot UI Extension | Serverless Function Fails to Find Local Module After Deployment in HubSpo</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubSpot-UI-Extension-Serverless-Function-Fails-to-Find-Local/m-p/1213642#M44321</link>
      <description>&lt;P&gt;Sorry to bother, I know it has been a while but I am chasing this issue myself. Did you find a solution?&lt;/P&gt;</description>
      <pubDate>Fri, 17 Oct 2025 22:27:04 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubSpot-UI-Extension-Serverless-Function-Fails-to-Find-Local/m-p/1213642#M44321</guid>
      <dc:creator>craigjacksonids</dc:creator>
      <dc:date>2025-10-17T22:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: HubSpot UI Extension | Serverless Function Fails to Find Local Module After Deployment in HubSpo</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubSpot-UI-Extension-Serverless-Function-Fails-to-Find-Local/m-p/1214272#M44336</link>
      <description>&lt;P&gt;Hi &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/610006"&gt;@craigjacksonids&lt;/a&gt;&lt;/SPAN&gt;,&lt;BR /&gt;&lt;BR /&gt;Thank you for posting to the Community!&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;It doesn't look like we've found a solution to this yet; however, let's tag in some Top Contributors to see if they have any ideas -- Hi &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/687354"&gt;@LauraMarie&lt;/a&gt; &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/586290"&gt;@ArisudanTiwari&lt;/a&gt; and &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/935114"&gt;@kosalaindrasiri&lt;/a&gt;. Do you have any suggestions?&lt;BR /&gt;&lt;BR /&gt;Thank you!&lt;BR /&gt;&lt;BR /&gt;Cassie, Community Manager&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2025 16:38:50 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubSpot-UI-Extension-Serverless-Function-Fails-to-Find-Local/m-p/1214272#M44336</guid>
      <dc:creator>chighsmith</dc:creator>
      <dc:date>2025-10-20T16:38:50Z</dc:date>
    </item>
    <item>
      <title>Re: HubSpot UI Extension | Serverless Function Fails to Find Local Module After Deployment in HubSpo</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubSpot-UI-Extension-Serverless-Function-Fails-to-Find-Local/m-p/1214304#M44337</link>
      <description>&lt;P&gt;What platform version are you using? Remember that version 2025.2 does NOT handle serverless functions. Make sure you're using 2025.1&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2025 17:57:23 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubSpot-UI-Extension-Serverless-Function-Fails-to-Find-Local/m-p/1214304#M44337</guid>
      <dc:creator>LauraMarie</dc:creator>
      <dc:date>2025-10-20T17:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: HubSpot UI Extension | Serverless Function Fails to Find Local Module After Deployment in HubSpo</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubSpot-UI-Extension-Serverless-Function-Fails-to-Find-Local/m-p/1214310#M44338</link>
      <description>&lt;P&gt;What platform version are you using? Remember that version 2025.2 does NOT handle serverless functions. Make sure you're using 2025.1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2025 18:03:28 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubSpot-UI-Extension-Serverless-Function-Fails-to-Find-Local/m-p/1214310#M44338</guid>
      <dc:creator>LauraMarie</dc:creator>
      <dc:date>2025-10-20T18:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: HubSpot UI Extension | Serverless Function Fails to Find Local Module After Deployment in HubSpo</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubSpot-UI-Extension-Serverless-Function-Fails-to-Find-Local/m-p/1214403#M44339</link>
      <description>Hi,&lt;BR /&gt;Thanks for your response.&lt;BR /&gt;&lt;BR /&gt;It is 2025.1 but I eventually found a hubspot article saying the local&lt;BR /&gt;includes are not supported with Hubspot's serverless functions so I just&lt;BR /&gt;have to cut and paste common routines into each function&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Craig&lt;BR /&gt;</description>
      <pubDate>Mon, 20 Oct 2025 23:33:07 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubSpot-UI-Extension-Serverless-Function-Fails-to-Find-Local/m-p/1214403#M44339</guid>
      <dc:creator>craigjacksonids</dc:creator>
      <dc:date>2025-10-20T23:33:07Z</dc:date>
    </item>
  </channel>
</rss>

