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

ContextHub.console is not a function error in AEM 6.5

Avatar

Avatar
Boost 1
Level 1
swetap37476554
Level 1

Like

1 like

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
swetap37476554
Level 1

Like

1 like

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile
swetap37476554
Level 1

24-07-2019

Hi,

We are trying to set up Context Hub in 6.5 and getting an error "Uncaught TypeError: ContextHub.console is not a function". Tried resolving using dependencies and changing the sling resourcetype from /libs/granite.. to granite path but its not working.

Can someone please help on the issue.

Replies

Avatar

Avatar
Coach
Employee
jbrar
Employee

Likes

380 likes

Total Posts

868 posts

Correct Reply

283 solutions
Top badges earned
Coach
Establish
Give Back 50
Give Back 5
Give Back 3
View profile

Avatar
Coach
Employee
jbrar
Employee

Likes

380 likes

Total Posts

868 posts

Correct Reply

283 solutions
Top badges earned
Coach
Establish
Give Back 50
Give Back 5
Give Back 3
View profile
jbrar
Employee

25-07-2019

Try comparing nodes under the path at [1] with a working instance(Or OOTB 6.5) and check if there are any missing or extra nodes.

[1]/libs/granite/contexthub

Avatar

Avatar
Give Back 10
Employee
lmha
Employee

Likes

16 likes

Total Posts

20 posts

Correct Reply

4 solutions
Top badges earned
Give Back 10
Give Back 5
Give Back 3
Give Back
Boost 5
View profile

Avatar
Give Back 10
Employee
lmha
Employee

Likes

16 likes

Total Posts

20 posts

Correct Reply

4 solutions
Top badges earned
Give Back 10
Give Back 5
Give Back 3
Give Back
Boost 5
View profile
lmha
Employee

25-07-2019

Hi swetap37476554,

Can you share the scenario in which the JavaScript error is thrown (share replication steps)?  Particularly, can you replicate this error thrown with the We.Retail sample content?  I referenced [1] to review the We.Retail sample content that has ContextHub already configured.

My vanilla 6.5 install showed me that ContextHub.console is not a function -- it is an object:

ContextHub

  1. {Callbacks: {…}, version: "0.4.18-20190304-1526", Paths: {…}, Constants: {…}, console: {…}, …}
    1. ...
    2. console:
      1. debug: ƒ ()
      2. error: ƒ ()
      3. info: ƒ ()
      4. log: ƒ ()
      5. time: ƒ ()
      6. timeEnd: ƒ ()
      7. timeStamp: ƒ ()
      8. warn: ƒ ()
      9. __proto__: Object

I used Developer Tool to call 'ContextHub' to review the object and what is present.

Regards,

Lisa

[1] Adding ContextHub to Pages and Accessing Stores

Avatar

Avatar
Give Back 5
Level 4
joeb21688728
Level 4

Likes

33 likes

Total Posts

60 posts

Correct Reply

8 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 25
Give Back 10
Give Back
View profile

Avatar
Give Back 5
Level 4
joeb21688728
Level 4

Likes

33 likes

Total Posts

60 posts

Correct Reply

8 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 25
Give Back 10
Give Back
View profile
joeb21688728
Level 4

25-07-2019

It looks like Adobe used to have documentation on these use cases [1]. However, I can't find the 6.5 version of this document.

1.  Using the Adobe Experience Manager ContextHub to work with Personal Experiences

Avatar

Avatar
Give Back 50
Employee
Vish_dhaliwal
Employee

Likes

188 likes

Total Posts

356 posts

Correct Reply

123 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile

Avatar
Give Back 50
Employee
Vish_dhaliwal
Employee

Likes

188 likes

Total Posts

356 posts

Correct Reply

123 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile
Vish_dhaliwal
Employee

25-07-2019

Hello,

Please share the complete stack trace of js error - Uncaught TypeError: ContextHub.console is not a function

Regards,

Vishu

Avatar

Avatar
Coach
Employee
jbrar
Employee

Likes

380 likes

Total Posts

868 posts

Correct Reply

283 solutions
Top badges earned
Coach
Establish
Give Back 50
Give Back 5
Give Back 3
View profile

Avatar
Coach
Employee
jbrar
Employee

Likes

380 likes

Total Posts

868 posts

Correct Reply

283 solutions
Top badges earned
Coach
Establish
Give Back 50
Give Back 5
Give Back 3
View profile
jbrar
Employee

25-07-2019

I am working on a similar issue and noticed this issue was caused by the syntax error at line 31. It should be :

ContextHub.console.log(ContextHub.Shared.timestamp(), '[loading] cq.contexthub - store.clientcontext-backedstore.js (clientcontext connector)');

There were extra quotes around the console."log" which was causing the issue. Try checking if that is the case here.

[1] /libs/cq/personalization/contexthub/components/stores/clientcontext-backedstore/store.clientcontext-backedstore.js

Avatar

Avatar
Give Back
Level 1
duggi_sandeep
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Give Back
View profile

Avatar
Give Back
Level 1
duggi_sandeep
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Give Back
View profile
duggi_sandeep
Level 1

04-12-2020

 

In below files also instead of using "ContextHub.console.log()" they committed ContextHub.console("log","") which causing "ContextHub.console is not a function" error.

can you please fix them

  1. /libs/cq/personalization/contexthub/clientlibs/contexthub/ContextHub.Store.ClientContextBackedStore.js

  2. /libs/cq/personalization/contexthub/clientlibs/clientcontextprofile/store.clientcontextprofile.js

 
 

contexthub_issue.png