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

Clientlib Javascript calls to Google geocoding and timezone work fine on author instance but not on publish instance ( but maps are fine)

Avatar

Avatar
Validate 10
Level 2
fionas76543059
Level 2

Likes

3 likes

Total Posts

68 posts

Correct Reply

1 solution
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
Applaud 5
View profile

Avatar
Validate 10
Level 2
fionas76543059
Level 2

Likes

3 likes

Total Posts

68 posts

Correct Reply

1 solution
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
Applaud 5
View profile
fionas76543059
Level 2

20-12-2019

Hi folks,

 

I am a total novice with AEM.

I had to write a component which had a JS Client library which made some calls to the Google map API and some calls to other Google services like geocoding and timezone. I finally thought I got everything working and it worked perfectly on the Author instance when I "Viewed as Published".  I have a valid Google Key.  This is the jquery  "map" call that works and the request/response shows up on the Network Pane of my Web Console.

$('.event-location', wrap).html('<a href="https://www.google.com/maps/place/'+map+'" target="_blank">'+ address +'</a>').show();

 This is the jquery call that doesn't even show up on the Network Pane of my Web Console. (It is as if AEM swallowed it.)

$.get("https://maps.googleapis.com/maps/api/geocode/json?key="+ $googleApiKey + "&address=" + address, function(geo_data, geo_status){

 The Author and Publish instances are on the AEM Cloud. I ssh'd into the Publish instance and was able to successfully "curl" the above maps.googleapis.com API call so it doesn't seem to be a firewall issue.

 

Any thoughts ?  I put the client library "with" its component in /apps and included the call to the Clientlib CSS at the start of the component HTL file and the call to the JS at the end. This seems to be the current recommended way but I didn't see any other components done that way in the legacy code so maybe I've missed something here.

 

I have read that "Publish" server is more "locked down" that the Author instance so maybe there is some URL blocking or whitelisting or something like that that I don't know anything about.

 

All suggestions gratefully received!

 

thanks

Fiona

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,358 likes

Total Posts

3,228 posts

Correct Reply

918 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,358 likes

Total Posts

3,228 posts

Correct Reply

918 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

20-12-2019

Yes, you need to enable an embed source. This can be done by allowing CORS.

This can be enabled at dispatcher level.

Answers (0)