Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

What could cause a ReferenceError ContextHub is not defined

Avatar

Avatar
Give Back
Level 1
Jeanmaradiaga
Level 1

Like

1 like

Total Posts

22 posts

Correct Reply

1 solution
Top badges earned
Give Back
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Give Back
Level 1
Jeanmaradiaga
Level 1

Like

1 like

Total Posts

22 posts

Correct Reply

1 solution
Top badges earned
Give Back
Validate 1
Boost 1
Affirm 1
View profile
Jeanmaradiaga
Level 1

14-04-2021

My project is using Bugsnag to catch errors in our AEM site, one recurring error is:

ReferenceError/en
ContextHub is not defined
 
The stack trace shows the following sequence of events: 
 
XMLHttpRequest succeeded
DOMContentLoaded
 
Page Loaded
Page Shown
ReferenceError: ContextHub is not defined
 
 

 

[
  {
    "file": "https://www.site.com/etc/cloudsettings.kernel.js/conf/global/settings/cloudsettings/company/contexthub",
    "method": "Object.<anonymous>",
    "lineNumber": 348,
    "columnNumber": 78
  },
  {
    "file": "https://www.site.com/etc/cloudsettings.kernel.js/conf/global/settings/cloudsettings/company/contexthub",
    "method": "m",
    "lineNumber": 96,
    "columnNumber": 350
  },
  {
    "file": "https://www.site.com/etc/cloudsettings.kernel.js/conf/global/settings/cloudsettings/company/contexthub",
    "method": "Object.fireWith [as resolveWith]",
    "lineNumber": 98,
    "columnNumber": 75
  },
  {
    "file": "https://www.site.com/etc/cloudsettings.kernel.js/conf/global/settings/cloudsettings/company/contexthub",
    "method": "b",
    "lineNumber": 172,
    "columnNumber": 434
  },
  {
    "file": "https://www.site.com/etc/cloudsettings.kernel.js/conf/global/settings/cloudsettings/company/contexthub",
    "method": "XMLHttpRequest.<anonymous>",
    "lineNumber": 182,
    "columnNumber": 160
  }
]

 

 

After that the page load perfectly, no rendering errors, no console errors.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Give Back 100
Level 10
asutosh_jena
Level 10

Likes

560 likes

Total Posts

677 posts

Correct Reply

194 solutions
Top badges earned
Give Back 100
Boost 500
Affirm 100
Ignite 1
Establish
View profile

Avatar
Give Back 100
Level 10
asutosh_jena
Level 10

Likes

560 likes

Total Posts

677 posts

Correct Reply

194 solutions
Top badges earned
Give Back 100
Boost 500
Affirm 100
Ignite 1
Establish
View profile
asutosh_jena
Level 10

15-04-2021

Hi @Jeanmaradiaga 

 

Do you see the content when you try to access the below URL in your website?

https://www.site.com/etc/cloudsettings.kernel.js/conf/global/settings/cloudsettings/company/contexthub

It should render the JS if it's working as expected.

 

If it's not loading that means there is a configration issue and the JS file is not loading which is why the tool is throwing ContextHub is not defined error.

 

Thanks! 

Answers (1)

Answers (1)

Avatar

Avatar
Affirm 3
Level 2
koenve
Level 2

Likes

13 likes

Total Posts

15 posts

Correct Reply

3 solutions
Top badges earned
Affirm 3
Establish
Validate 1
Give Back
Boost 5
View profile

Avatar
Affirm 3
Level 2
koenve
Level 2

Likes

13 likes

Total Posts

15 posts

Correct Reply

3 solutions
Top badges earned
Affirm 3
Establish
Validate 1
Give Back
Boost 5
View profile
koenve
Level 2

15-04-2021

Hey!

 

The AEM project archetype creates a page component for you when initialising your project. That page is including the contexthub code in your page. If you’re not using contexthub (and you’re not planning to use it either) you’re safe to remove it from your code.

 

You should find something back under your page component in “customheaderlibs.html”:

<sly data-sly-resource="${'contexthub' @ resourceType='granite/contexthub/components/contexthub'}"/>

 If you remove this line, the error shouldn’t appear anymore.

Hope this helps!

Koen