"Uncaught TypeError: Cannot read property 'getImageSource' of undefined" Javascript error in SKUID page

  • 2
  • Question
  • Updated 2 years ago
  • Answered
Javascript error which wasn't earlier when we developed the SKUID page
Photo of Manoj

Manoj

  • 210 Points 100 badge 2x thumb
  • frustrated

Posted 2 years ago

  • 2
Photo of Amy Dewaal

Amy Dewaal, Official Rep

  • 8,200 Points 5k badge 2x thumb
Manoj,
  • What version of Skuid are you on?
  • Do you have any images on that page?
  • Does the page load despite the error or is it completely blank?
Thanks!
Photo of Manoj

Manoj

  • 210 Points 100 badge 2x thumb
Hi Amy,

Thanks for your reply.

Version - 9.3.3
Yes, we have one image from static resource.
When I tried to preview the page its completly blank.

Hope I have provided the requested information. Please let me know if you need any other information.

Thanks,
Manoj
Photo of Amy Dewaal

Amy Dewaal, Official Rep

  • 8,200 Points 5k badge 2x thumb
Manoj,

If you click on the image in page builder (without changing anything) does the Save button render as if you made changes? If so can you save the page and preview and see if the problem still exists?

I know that's kind of odd but there's a difference between images in Rockaway and Brooklyn. New to Brooklyn, you can choose a data source to pull an image from, and that means if you had an image in Rockaway and then upgrade to Brooklyn, there's a small piece of data missing from the image definition. Normally it's not a problem, but if you don't have any models on the page it creates the error you're seeing. 

Thanks!
Photo of Manoj

Manoj

  • 210 Points 100 badge 2x thumb
Hi Amy,

As you mentioned above comment, when I click the image and saved the page its working now.

May I know the reason behind this ?

Thanks,
Manoj
Photo of Amy Dewaal

Amy Dewaal, Official Rep

  • 8,200 Points 5k badge 2x thumb
Manoj,

I'm glad that fixed it! The reason behind this weirdness can be traced to the change in images from Rockaway to Brooklyn. In Rockaway you retrieve an image from a static resource, a specific model, or a specific url. In Brooklyn you retrieve an image through a datasource and then through a model or url. Because of that, the definition for an image on the backend expanded in Brooklyn (you have to define a datasource). If you upgrade from Rockaway to Brooklyn, your image is missing a defined datasource. If you have a model defined on your page then Skuid handles that missing data okay (not entirely sure why, but it does). However, if your image is missing a datasource and you don't have any models defined, then I think Skuid looks for a datasource, doesn't find one, and throws the error you saw. When you click on the image, Skuid shows you the image properties, and a datasource as part of those properties. Since you didn't have one defined, it shows the default datasource, leaving all your other information in tact so that your image still displays as it should. Because data was added to the image, the save button renders, and after you save you have a datasource defined (even if it's not one you use or care about) and so the error goes away. Hope that sort of makes sense.

Thanks!
Photo of Manoj

Manoj

  • 210 Points 100 badge 2x thumb
Thanks for the information Amy.

But now we had the below script error which was working previously.

"Uncaught TypeError: Cannot read property 'top' of undefined"

Thanks,
Manoj
Photo of Amy Dewaal

Amy Dewaal, Official Rep

  • 8,200 Points 5k badge 2x thumb
Manoj,

Is this issue also causing your page to go blank? Do you have any custom javascript snippets on the page? 

Thanks!
Photo of Manoj

Manoj

  • 210 Points 100 badge 2x thumb
we have written the Javascript code in Template component, earlier it was working fine. . but now its not working
Photo of Eulogio Gallo

Eulogio Gallo

  • 1,874 Points 1k badge 2x thumb
Any updates on this issue?  I'm encountering something similar.
Photo of Amy Dewaal

Amy Dewaal, Official Rep

  • 8,200 Points 5k badge 2x thumb
Eulogio,

Some questions to help us troubleshoot:
  1. What Skuid version are you on?
  2. What browser are you using?
  3. Are you seeing this in Skuid on classic Salesforce or in Lightning?
  4. What affect, if any, does this error message have on your Skuid page (does the page not load or does it load fine and you just also get this error in the console)?
Photo of Eulogio Gallo

Eulogio Gallo

  • 1,874 Points 1k badge 2x thumb
  1. I'm on version 9.5.4
  2. I'm using Google Chrome
  3. SKUID on Classic Salesforce
  4. It prevents the page from loading successfully.
I also had a thread open here: https://community.skuid.com/skuid/topics/javascript-error-on-previously-working-template-component

Didn't mean to hijack this one!