GraphQL results on website module

_Louis_
Participant

I'm following the instructions here Use data from a GraphQL query in your website pages - HubSpot docs attempting to create a listing page that runs off data in a graphQL query.

 

Unfortunately, I cannot get the module to display any results.

_Louis__1-1764316545453.png

 

 

_Louis__0-1764316506610.png

 

When I test the query in GraphiQL it works as expected, returning results.

_Louis__0-1764316805474.png

 

 

0 Upvotes
1 Accepted solution
RubenBurdin
Solution
Top Contributor

Hi @_Louis_ 

I’ve run into this a few times, and the behavior you’re describing almost always comes down to scope or context rather than the query itself.

 

The GraphiQL console runs in the account’s full context, but a module only returns results if the query is defined inside that module and exposed through the data_query tag in the module HTML. If the tag isn’t present, or if the query name doesn’t match exactly, the module simply renders nothing even though the query works in isolation

(https://developers.hubspot.com/docs/cms/start-building/introduction/react-plus-hubl/data-fetching )

 

Another thing to double-check is where the module sits. Queries only execute in “page” or “template” contexts, not in global partials or header/footer includes. If the module is nested inside something that prevents a data fetch, it will silently fail.

 

You can confirm this quickly by dropping the module directly onto a blank test page and seeing if results appear. If your listing page also needs to reflect data changes from an external system, Stacksync keeps those objects aligned in real time so your GraphQL module always pulls up-to-date values.

Did my answer help? Please mark it as a solution to help others find it too.

Ruben Burdin Ruben Burdin
HubSpot Advisor
Founder @ Stacksync
Real-Time Data Sync between any CRM and Database
Stacksync Banner

View solution in original post

0 Upvotes
2 Replies 2
RubenBurdin
Solution
Top Contributor

Hi @_Louis_ 

I’ve run into this a few times, and the behavior you’re describing almost always comes down to scope or context rather than the query itself.

 

The GraphiQL console runs in the account’s full context, but a module only returns results if the query is defined inside that module and exposed through the data_query tag in the module HTML. If the tag isn’t present, or if the query name doesn’t match exactly, the module simply renders nothing even though the query works in isolation

(https://developers.hubspot.com/docs/cms/start-building/introduction/react-plus-hubl/data-fetching )

 

Another thing to double-check is where the module sits. Queries only execute in “page” or “template” contexts, not in global partials or header/footer includes. If the module is nested inside something that prevents a data fetch, it will silently fail.

 

You can confirm this quickly by dropping the module directly onto a blank test page and seeing if results appear. If your listing page also needs to reflect data changes from an external system, Stacksync keeps those objects aligned in real time so your GraphQL module always pulls up-to-date values.

Did my answer help? Please mark it as a solution to help others find it too.

Ruben Burdin Ruben Burdin
HubSpot Advisor
Founder @ Stacksync
Real-Time Data Sync between any CRM and Database
Stacksync Banner
0 Upvotes
BérangèreL
Community Manager
Community Manager

Hey @_Louis_ 👋 and Happy Friday!

Thanks for reaching out to the HubSpot Community!

I'd like to share some resources that might help:

- Query HubSpot data using GraphQL
- Build a recruiting agency website using GraphQL

Now, let's consult our Top Experts: Hi @Teun, @MichaelMa and @RubenBurdin do you have suggestions to help @_Louis_, please?

Have a wonderful weekend and thanks so much!
Bérangère





loop


Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.

Learn More




0 Upvotes