React module not loading in live version

Hi all,
We are currently facing an issue where a React module that was working perfectly before is now only displaying a placeholder in the live version of our project. The module still works as expected in the editor and preview mode, but once published, it does not load.

The placeholder looks like this:

<!-- HubSpot JS module render request placeholder comment v2 https://bhouz67qe5utc2icvheiwnnomu0npzhh.lambda-url.eu-central-1.on.aws/ {"entryPoint":"@projects/serry-project/serry-app/components/modules/ProductOverview","buildId":7,"functionArn":null,"props":{"contact":null,"experimentalHublData":null,"fieldValues":{"category":"Terrastegels","filterPreset":"looks","look":"Stonelook","room":"Badkamer"},"getServerSidePropsDependencies":{"contact":false,"fullRequest":false,"moduleProps":true,"urlWithQuery":false,"urlWithoutQuery":false},"hublData":{"query":{},"accountId":144072751},"hublParameters":{"field_types":{"category":"choice","filterPreset":"choice","look":"choice","room":"choice"},"isJsModule":true,"is_widget_block":true,"label":"Product advanced filter","module_id":200790985971,"org_tag":"module_block","parent_widget_container":"dnd_area","path":"@projects/serry-project/serry-app/components/modules/ProductOverview","smart_type":"NOT_SMART","widget_type":"module","wrap_field_tag":"div"},"moduleName":"widget_1739179796350","reactBuildMeta":{"buildSupports":{"batchingV1":true},"buildTs":1739183689515,"contentDescriptors":null,"dataDependencies":null,"getServerSidePropsDependencies":{"contact":false,"fullRequest":false,"moduleProps":true,"urlWithQuery":false,"urlWithoutQuery":false},"hasGetServerSideProps":true,"schema":"1"},"request":null,"resolvedDataDependencies":null,"supplementalFieldValues":{"category":{},"filterPreset":{},"look":{},"room":{}},"urlWithQuery":null,"urlWithoutQuery":null},"enableLambdaDebugging":false,"request":{"cookies":{"__cf_bm":"AfsZ.HK1lVdC8XscGBF6ybA.IiJgros0RtADaSqT8nY-1739194046-1.0.1.1-HjkcxlYEYTkUZWa5n6I29qd_v9X6WjouxbVuVa3uULP4cUMRzpRpbOEPFoQalovqRVfWHoSevAH5LoJT3S_xMQ","_cfuvid":"YXFCpbq1PBvgv8FT7uiIuKL8oSAwsgFC1XxHGPBocmY-1739182523732-0.0.1.1-604800000"},"debug":false,"domain":"tegels-serry.be","fullUrl":"https://tegels-serry.be/tegels/looks/stonelook","path":"/tegels/looks/stonelook","pathAndQuery":"/tegels/looks/stonelook?","pathParamDict":{},"preRenderView":false,"query":"","queryDict":{},"scheme":"https"},"portalId":144072751,"hublet":"eu1","hublTemplatePath":"Serry Theme/templates/Testing Page.html","gates":["CMS:JSRenderer:SeparateIslandRenderOption","CMS:JSRenderer:GraphQLQueryBuild","CMS:JSRenderer:MinifyCSS","CMS:JSRenderer:GetServerSideProps","Jsr:DeployLambdasViaCommonAwsAccount","CMS:JSRenderer:LocalProxySchemaVersion1","CMS:JSRenderer:SharedDeps"],"uniqueRenderRequest":"6d6c41i1","moduleFieldsResolutionResult":null,"tagParams":null,"secrets":null,"defaultReactModuleDeployId":null,"renderSource":null,"customBaseAssetUrl":null,"dataQueryResult":{}}-->

We’ve already tried:

  • Redeploying the project containing the module
  • Republishing the page and template

Despite these efforts, the issue persists. Interestingly, on one of our pages, the module suddenly started rendering again, but it remains broken on many others.

It seems like this could be a HubSpot issue, possibly with how the module is being processed in the live environment. Has anyone else experienced similar behavior with JavaScript modules in HubSpot? Any advice or insights would be greatly appreciated.

Thanks in advance!

Update: We’ve found some additional details about this issue. The module temporarily starts working when we move it to a different position on the page and then back to its original position. However, after a few minutes, it reverts back to showing just the placeholder.
Interestingly, the module works consistently on one of our pages while failing on others, even though all pages use the same HubL template. This suggests the issue might be related to caching or module initialization rather than the template or module configuration itself.
These temporary fixes and inconsistent behavior across pages might help in identifying the root cause of the issue.

Hi Michiel -
I’m wondering if you were eventually able to solve for this? I am in the process of deploying one of our custom modules to our production environment now and running into the exact same issue.
Any guidance would be appreciated. Thank you!

Hi JPFarfan,

Yes, we were eventually able to solve the issue!

We unexpectedly fixed it by adding a component like this to all of our page templates. This seems to have triggered something on HubSpot’s rendering logic which causes the modules to render correctly.

interface Props {
 serverSideProps: {
 test: string;
 };
}

export const getServerSideProps = withModuleProps(async () => ({
 serverSideProps: {
 test: crypto.randomUUID()
 },
 caching: {
 cacheControl: {
 noCache: true
 }
 }
}));

export const Component: FC<Props> = ({ serverSideProps }) => (
 <div className="hidden">{serverSideProps.test}</div>
);

export const fields = <ModuleFields>no fields</ModuleFields>;

Not the most elegant fix, but it’s been working reliably for us.

Hope this helps!

Kind regards,
Michiel

Hey, @Michiel-Koho :waving_hand: Thank you for coming back and sharing what worked for you! — Jaycee