<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Issue with Custom Module Fetching &amp;quot;Member Spotlight&amp;quot; Data on Belong.naifa.org in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Issue-with-Custom-Module-Fetching-quot-Member-Spotlight-quot/m-p/1141469#M42816</link>
    <description>&lt;P&gt;On the website &lt;A href="https://belong.naifa.org" target="_blank" rel="noopener"&gt;https://belong.naifa.org&lt;/A&gt;, the "Member Spotlight" section located above the footer is sometimes not loading properly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We've developed a custom module that fetches data from : &lt;A href="https://members.naifa.org/member-spotlights" target="_blank" rel="noopener"&gt;https://members.naifa.org/member-spotlights&lt;/A&gt;, but occasionally it displays an error message (please see the attached screenshot).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="loading-error.png" style="width: 640px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/144543i46B35C8DB2CB2AB2/image-size/large?v=v2&amp;amp;px=999" role="button" title="loading-error.png" alt="loading-error.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here the code that we have used in the custom module:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;div class="spotlight-wrapper"&amp;gt;&lt;BR /&gt;&amp;lt;div class="spotlight-title"&amp;gt;Member Spotlights&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;div id="loader" class="loader"&amp;gt;&lt;BR /&gt;&amp;lt;div class="spinner"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;div id="spotlight-list" class="article-cards spotlights-container" style="display: none;"&amp;gt;&lt;BR /&gt;&amp;lt;!-- Spotlight content will be injected here --&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;document.addEventListener("DOMContentLoaded", function () {&lt;BR /&gt;const spotlightContainer = document.getElementById('spotlight-list');&lt;BR /&gt;const loader = document.getElementById('loader');&lt;/P&gt;&lt;P&gt;const url = "&lt;A href="https://api.allorigins.win/raw?url=" target="_blank" rel="noopener"&gt;https://api.allorigins.win/raw?url=&lt;/A&gt;" + encodeURIComponent("&lt;A href="https://members.naifa.org/member-spotlights" target="_blank" rel="noopener"&gt;https://members.naifa.org/member-spotlights&lt;/A&gt;");&lt;/P&gt;&lt;P&gt;fetch(url)&lt;BR /&gt;.then(response =&amp;gt; response.text())&lt;BR /&gt;.then(html =&amp;gt; {&lt;BR /&gt;const parser = new DOMParser();&lt;BR /&gt;const doc = parser.parseFromString(html, "text/html");&lt;BR /&gt;const events = doc.querySelectorAll(".main-box");&lt;/P&gt;&lt;P&gt;if (events.length === 0) {&lt;BR /&gt;loader.innerHTML = "&amp;lt;p&amp;gt;No spotlight content available.&amp;lt;/p&amp;gt;";&lt;BR /&gt;return;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;spotlightContainer.innerHTML = "";&lt;/P&gt;&lt;P&gt;events.forEach((event, index) =&amp;gt; {&lt;BR /&gt;if (index &amp;gt;= 3) return;&lt;/P&gt;&lt;P&gt;const image = event.querySelector(".hs_cos_wrapper img")?.src || "";&lt;BR /&gt;let strongs = event.querySelectorAll("p strong");&lt;BR /&gt;let name = strongs[0]?.innerHTML || "";&lt;BR /&gt;let subtitle = strongs.length &amp;gt; 1 ? strongs[1].innerHTML : "";&lt;/P&gt;&lt;P&gt;let title = `&amp;lt;span class="name"&amp;gt;${name}&amp;lt;/span&amp;gt;&amp;lt;span class="subtitle"&amp;gt;${subtitle}&amp;lt;/span&amp;gt;`;&lt;/P&gt;&lt;P&gt;let anchor = event.querySelector("a[href*='member-spotlight']");&lt;BR /&gt;let link = "#";&lt;BR /&gt;if (anchor) {&lt;BR /&gt;let rawHref = anchor.getAttribute("href") || "#";&lt;BR /&gt;try {&lt;BR /&gt;link = new URL(rawHref, "&lt;A href="https://at.naifa.org" target="_blank" rel="noopener"&gt;https://at.naifa.org&lt;/A&gt;").href;&lt;BR /&gt;} catch (err) {&lt;BR /&gt;console.warn("Invalid link:", rawHref);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;spotlightContainer.innerHTML += `&lt;BR /&gt;&amp;lt;div class="article-card"&amp;gt;&lt;BR /&gt;&amp;lt;div class="article-image"&amp;gt;&lt;BR /&gt;&amp;lt;img src="${image}" alt="${name}"&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;div class="article-text"&amp;gt;&lt;BR /&gt;&amp;lt;h2&amp;gt;${title}&amp;lt;/h2&amp;gt;&lt;BR /&gt;&amp;lt;a href="${link}" class="read-more" rel="noopener"&amp;gt;Read More →&amp;lt;/a&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;`;&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;loader.style.display = "none";&lt;BR /&gt;spotlightContainer.style.display = "flex";&lt;BR /&gt;})&lt;BR /&gt;.catch(error =&amp;gt; {&lt;BR /&gt;console.error('Error loading spotlight content:', error);&lt;BR /&gt;loader.innerHTML = '&amp;lt;p&amp;gt;Spotlight content is currently unavailable. Please check back later.&amp;lt;/p&amp;gt;';&lt;BR /&gt;});&lt;BR /&gt;});&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please help in resolving this issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 28 Apr 2025 06:00:06 GMT</pubDate>
    <dc:creator>soorajvtrio</dc:creator>
    <dc:date>2025-04-28T06:00:06Z</dc:date>
    <item>
      <title>Issue with Custom Module Fetching "Member Spotlight" Data on Belong.naifa.org</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Issue-with-Custom-Module-Fetching-quot-Member-Spotlight-quot/m-p/1141469#M42816</link>
      <description>&lt;P&gt;On the website &lt;A href="https://belong.naifa.org" target="_blank" rel="noopener"&gt;https://belong.naifa.org&lt;/A&gt;, the "Member Spotlight" section located above the footer is sometimes not loading properly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We've developed a custom module that fetches data from : &lt;A href="https://members.naifa.org/member-spotlights" target="_blank" rel="noopener"&gt;https://members.naifa.org/member-spotlights&lt;/A&gt;, but occasionally it displays an error message (please see the attached screenshot).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="loading-error.png" style="width: 640px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/144543i46B35C8DB2CB2AB2/image-size/large?v=v2&amp;amp;px=999" role="button" title="loading-error.png" alt="loading-error.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here the code that we have used in the custom module:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;div class="spotlight-wrapper"&amp;gt;&lt;BR /&gt;&amp;lt;div class="spotlight-title"&amp;gt;Member Spotlights&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;div id="loader" class="loader"&amp;gt;&lt;BR /&gt;&amp;lt;div class="spinner"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;div id="spotlight-list" class="article-cards spotlights-container" style="display: none;"&amp;gt;&lt;BR /&gt;&amp;lt;!-- Spotlight content will be injected here --&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;document.addEventListener("DOMContentLoaded", function () {&lt;BR /&gt;const spotlightContainer = document.getElementById('spotlight-list');&lt;BR /&gt;const loader = document.getElementById('loader');&lt;/P&gt;&lt;P&gt;const url = "&lt;A href="https://api.allorigins.win/raw?url=" target="_blank" rel="noopener"&gt;https://api.allorigins.win/raw?url=&lt;/A&gt;" + encodeURIComponent("&lt;A href="https://members.naifa.org/member-spotlights" target="_blank" rel="noopener"&gt;https://members.naifa.org/member-spotlights&lt;/A&gt;");&lt;/P&gt;&lt;P&gt;fetch(url)&lt;BR /&gt;.then(response =&amp;gt; response.text())&lt;BR /&gt;.then(html =&amp;gt; {&lt;BR /&gt;const parser = new DOMParser();&lt;BR /&gt;const doc = parser.parseFromString(html, "text/html");&lt;BR /&gt;const events = doc.querySelectorAll(".main-box");&lt;/P&gt;&lt;P&gt;if (events.length === 0) {&lt;BR /&gt;loader.innerHTML = "&amp;lt;p&amp;gt;No spotlight content available.&amp;lt;/p&amp;gt;";&lt;BR /&gt;return;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;spotlightContainer.innerHTML = "";&lt;/P&gt;&lt;P&gt;events.forEach((event, index) =&amp;gt; {&lt;BR /&gt;if (index &amp;gt;= 3) return;&lt;/P&gt;&lt;P&gt;const image = event.querySelector(".hs_cos_wrapper img")?.src || "";&lt;BR /&gt;let strongs = event.querySelectorAll("p strong");&lt;BR /&gt;let name = strongs[0]?.innerHTML || "";&lt;BR /&gt;let subtitle = strongs.length &amp;gt; 1 ? strongs[1].innerHTML : "";&lt;/P&gt;&lt;P&gt;let title = `&amp;lt;span class="name"&amp;gt;${name}&amp;lt;/span&amp;gt;&amp;lt;span class="subtitle"&amp;gt;${subtitle}&amp;lt;/span&amp;gt;`;&lt;/P&gt;&lt;P&gt;let anchor = event.querySelector("a[href*='member-spotlight']");&lt;BR /&gt;let link = "#";&lt;BR /&gt;if (anchor) {&lt;BR /&gt;let rawHref = anchor.getAttribute("href") || "#";&lt;BR /&gt;try {&lt;BR /&gt;link = new URL(rawHref, "&lt;A href="https://at.naifa.org" target="_blank" rel="noopener"&gt;https://at.naifa.org&lt;/A&gt;").href;&lt;BR /&gt;} catch (err) {&lt;BR /&gt;console.warn("Invalid link:", rawHref);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;spotlightContainer.innerHTML += `&lt;BR /&gt;&amp;lt;div class="article-card"&amp;gt;&lt;BR /&gt;&amp;lt;div class="article-image"&amp;gt;&lt;BR /&gt;&amp;lt;img src="${image}" alt="${name}"&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;div class="article-text"&amp;gt;&lt;BR /&gt;&amp;lt;h2&amp;gt;${title}&amp;lt;/h2&amp;gt;&lt;BR /&gt;&amp;lt;a href="${link}" class="read-more" rel="noopener"&amp;gt;Read More →&amp;lt;/a&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;`;&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;loader.style.display = "none";&lt;BR /&gt;spotlightContainer.style.display = "flex";&lt;BR /&gt;})&lt;BR /&gt;.catch(error =&amp;gt; {&lt;BR /&gt;console.error('Error loading spotlight content:', error);&lt;BR /&gt;loader.innerHTML = '&amp;lt;p&amp;gt;Spotlight content is currently unavailable. Please check back later.&amp;lt;/p&amp;gt;';&lt;BR /&gt;});&lt;BR /&gt;});&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please help in resolving this issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Apr 2025 06:00:06 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Issue-with-Custom-Module-Fetching-quot-Member-Spotlight-quot/m-p/1141469#M42816</guid>
      <dc:creator>soorajvtrio</dc:creator>
      <dc:date>2025-04-28T06:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Custom Module Fetching "Member Spotlight" Data on Belong.naifa.org</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Issue-with-Custom-Module-Fetching-quot-Member-Spotlight-quot/m-p/1141791#M42834</link>
      <description>&lt;P&gt;Hey, &lt;SPAN style="color:var(--ck-color-mention-text);"&gt;&lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/935083"&gt;@soorajvtrio&lt;/a&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;span class="lia-unicode-emoji" title=":waving_hand:"&gt;👋&lt;/span&gt; Thanks for your post and for including your details. This one is tough to troubleshoot. I'd like to offer a few high-level suggestions and troubleshooting steps. Hopefully, this will help get you unstuck and give our community members more information.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Suggestions:&lt;/P&gt;
&lt;P&gt;Implement Content Caching&lt;/P&gt;
&lt;UL&gt;
 &lt;LI&gt;store successfully fetched content in `localStorage` with an expiration time&lt;/LI&gt;
 &lt;LI&gt;fall back to cached content when new fetches fail&lt;/LI&gt;
 &lt;LI&gt;to provide a better experience during temporary outages&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Error Handling&lt;/P&gt;
&lt;UL&gt;
 &lt;LI&gt;add timeouts to prevent indefinite loading states&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;CORS issues&lt;/P&gt;
&lt;UL&gt;
 &lt;LI&gt;do we have any way to know if the allorigins.win service experiencing reliability issues&lt;/LI&gt;
 &lt;LI&gt;&lt;A href="https://developers.hubspot.com/docs/guides/cms/content/data-driven-content/serverless-functions/overview" target="_blank"&gt;&lt;STRONG&gt;Serverless functions&lt;/STRONG&gt;&lt;/A&gt; might be a more reliable proxy&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Troubleshooting:&lt;/P&gt;
&lt;P&gt;Check Browser Console&lt;/P&gt;
&lt;UL&gt;
 &lt;LI&gt;is there anything unexpected or interesting here when the content fails to load?&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Patterns&lt;/P&gt;
&lt;UL&gt;
 &lt;LI&gt;does the error occur at specific times of day?&lt;/LI&gt;
 &lt;LI&gt;is it happening on particular browsers or devices?&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Validate&lt;/P&gt;
&lt;UL&gt;
 &lt;LI&gt;has the source page structure at members.naifa.org has changed?&lt;/LI&gt;
 &lt;LI&gt;can you manually navigate to the source page works when the error occurs?&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Remember that with community troubleshooting, providing more details about when and how the error occurs will help others provide more targeted assistance.​​​​​​​​​​​​​​​​&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Talk soon! — Jaycee&lt;/P&gt;</description>
      <pubDate>Mon, 28 Apr 2025 17:13:58 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Issue-with-Custom-Module-Fetching-quot-Member-Spotlight-quot/m-p/1141791#M42834</guid>
      <dc:creator>Jaycee_Lewis</dc:creator>
      <dc:date>2025-04-28T17:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Custom Module Fetching "Member Spotlight" Data on Belong.naifa.org</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Issue-with-Custom-Module-Fetching-quot-Member-Spotlight-quot/m-p/1144413#M42919</link>
      <description>&lt;P&gt;Adding the code here in a code block so that it is readable&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;div class="spotlight-wrapper"&amp;gt;
    &amp;lt;div class="spotlight-title"&amp;gt;Member Spotlights&amp;lt;/div&amp;gt;
    &amp;lt;div id="loader" class="loader"&amp;gt;
        &amp;lt;div class="spinner"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div id="spotlight-list" class="article-cards spotlights-container" style="display: none;"&amp;gt;
        &amp;lt;!-- Spotlight content will be injected here --&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;script&amp;gt;
    document.addEventListener("DOMContentLoaded", function () {
        const spotlightContainer = document.getElementById('spotlight-list')
        const loader = document.getElementById('loader')

        const url = "https://api.allorigins.win/raw?url=" + encodeURIComponent("https://members.naifa.org/member-spotlights")

        fetch(url)
            .then(response =&amp;gt; response.text())
            .then(html =&amp;gt; {
                const parser = new DOMParser()
                const doc = parser.parseFromString(html, "text/html")
                const events = doc.querySelectorAll(".main-box")

                if (events.length === 0) {
                    loader.innerHTML = "&amp;lt;p&amp;gt;No spotlight content available.&amp;lt;/p&amp;gt;"
                    return
                }

                spotlightContainer.innerHTML = ""

                events.forEach((event, index) =&amp;gt; {
                    if (index &amp;gt;= 3) return

                    const image = event.querySelector(".hs_cos_wrapper img")?.src || ""
                    let strongs = event.querySelectorAll("p strong")
                    let name = strongs[0]?.innerHTML || ""
                    let subtitle = strongs.length &amp;gt; 1 ? strongs[1].innerHTML : ""

                    let title = `&amp;lt;span class="name"&amp;gt;${name}&amp;lt;/span&amp;gt;&amp;lt;span class="subtitle"&amp;gt;${subtitle}&amp;lt;/span&amp;gt;`

                    let anchor = event.querySelector("a[href*='member-spotlight']")
                    let link = "#"
                    if (anchor) {
                        let rawHref = anchor.getAttribute("href") || "#"
                        try {
                            link = new URL(rawHref, "https://at.naifa.org").href
                        } catch (err) {
                            console.warn("Invalid link:", rawHref)
                        }
                    }

                    spotlightContainer.innerHTML += `
                        &amp;lt;div class="article-card"&amp;gt;
                            &amp;lt;div class="article-image"&amp;gt;
                                &amp;lt;img src="${image}" alt="${name}"&amp;gt;
                            &amp;lt;/div&amp;gt;
                            &amp;lt;div class="article-text"&amp;gt;
                                &amp;lt;h2&amp;gt;${title}&amp;lt;/h2&amp;gt;
                                &amp;lt;a href="${link}" class="read-more" rel="noopener"&amp;gt;Read More →&amp;lt;/a&amp;gt;
                            &amp;lt;/div&amp;gt;
                        &amp;lt;/div&amp;gt;
                    `
                })

                loader.style.display = "none"
                spotlightContainer.style.display = "flex"
            })
            .catch(error =&amp;gt; {
                console.error('Error loading spotlight content:', error)
                loader.innerHTML = '&amp;lt;p&amp;gt;Spotlight content is currently unavailable. Please check back later.&amp;lt;/p&amp;gt;'
            })
    })
&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 05 May 2025 14:04:02 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Issue-with-Custom-Module-Fetching-quot-Member-Spotlight-quot/m-p/1144413#M42919</guid>
      <dc:creator>nickdeckerdevs1</dc:creator>
      <dc:date>2025-05-05T14:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Custom Module Fetching "Member Spotlight" Data on Belong.naifa.org</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Issue-with-Custom-Module-Fetching-quot-Member-Spotlight-quot/m-p/1144426#M42921</link>
      <description>&lt;P&gt;Unfortunatly we can't determine what the acutal error is..&lt;BR /&gt;&lt;BR /&gt;You would need to understan the error that is being ouput from the fetch call -- you can debug this in the console in dev tools, you could also add the following to your catch to improve what you need to look at.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;console.error('Error details:')
console.log(error)
console.log('message')
console.log(error.message)
console.log('name')
console.log(error.name)
console.log('stack')
console.log(error.stack)
console.log('url')
console.log(url)
console.log('new Date().toISOString()')
console.log(new Date().toISOString())&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depending on the error, you may want to have it retry if there is an error -- so having some sort of variable for calls made to the api&lt;BR /&gt;&lt;BR /&gt;If this is just some random failure, it might be worth counting the errors, and recalling the function to fetch the data. That would take some reworking of your code to make it so that the functions are seperated out....&lt;BR /&gt;&lt;BR /&gt;let me know how else I can help and where you are getting stuck at&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 May 2025 14:18:27 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Issue-with-Custom-Module-Fetching-quot-Member-Spotlight-quot/m-p/1144426#M42921</guid>
      <dc:creator>nickdeckerdevs1</dc:creator>
      <dc:date>2025-05-05T14:18:27Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Custom Module Fetching "Member Spotlight" Data on Belong.naifa.org</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Issue-with-Custom-Module-Fetching-quot-Member-Spotlight-quot/m-p/1144434#M42924</link>
      <description>&lt;P&gt;All the code below is AI generated, making sure to include the console errors in it after three attempts. I'd review the code before implementing, but basically what it is doing is trying every 800ms and checkint to see if teh max retries have happened, if after the three attempts happens, then it reports the error to the screen and the error details to the console&lt;BR /&gt;&lt;BR /&gt;You will only be able to understand what the actual error is if you are on the page when the error happens&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;div class="spotlight-wrapper"&amp;gt;
    &amp;lt;div class="spotlight-title"&amp;gt;Member Spotlights&amp;lt;/div&amp;gt;
    &amp;lt;div id="loader" class="loader"&amp;gt;
        &amp;lt;div class="spinner"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div id="spotlight-list" class="article-cards spotlights-container" style="display: none;"&amp;gt;
        &amp;lt;!-- Spotlight content will be injected here --&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;script&amp;gt;
    document.addEventListener("DOMContentLoaded", function () {
        const spotlightContainer = document.getElementById('spotlight-list')
        const loader = document.getElementById('loader')

        const delay = ms =&amp;gt; new Promise(resolve =&amp;gt; setTimeout(resolve, ms))

        async function fetchWithRetry(url, maxRetries = 3, delayMs = 800) {
            let lastError

            for (let attempt = 1; attempt &amp;lt;= maxRetries; attempt++) {
                try {
                    const response = await fetch(url)
                    return await response.text()
                } catch (error) {
                    lastError = error
                    if (attempt &amp;lt; maxRetries) {
                        await delay(delayMs)
                    }
                }
            }
            throw lastError
        }

        async function loadSpotlights() {
            const url = "https://api.allorigins.win/raw?url=" + encodeURIComponent("https://members.naifa.org/member-spotlights")

            try {
                const html = await fetchWithRetry(url)
                const parser = new DOMParser()
                const doc = parser.parseFromString(html, "text/html")
                const events = doc.querySelectorAll(".main-box")

                if (events.length === 0) {
                    loader.innerHTML = "&amp;lt;p&amp;gt;No spotlight content available.&amp;lt;/p&amp;gt;"
                    return
                }

                spotlightContainer.innerHTML = ""

                events.forEach((event, index) =&amp;gt; {
                    if (index &amp;gt;= 3) return

                    const image = event.querySelector(".hs_cos_wrapper img")?.src || ""
                    let strongs = event.querySelectorAll("p strong")
                    let name = strongs[0]?.innerHTML || ""
                    let subtitle = strongs.length &amp;gt; 1 ? strongs[1].innerHTML : ""

                    let title = `&amp;lt;span class="name"&amp;gt;${name}&amp;lt;/span&amp;gt;&amp;lt;span class="subtitle"&amp;gt;${subtitle}&amp;lt;/span&amp;gt;`

                    let anchor = event.querySelector("a[href*='member-spotlight']")
                    let link = "#"
                    if (anchor) {
                        let rawHref = anchor.getAttribute("href") || "#"
                        try {
                            link = new URL(rawHref, "https://at.naifa.org").href
                        } catch (err) {
                            console.warn("Invalid link:", rawHref)
                        }
                    }

                    spotlightContainer.innerHTML += `
                        &amp;lt;div class="article-card"&amp;gt;
                            &amp;lt;div class="article-image"&amp;gt;
                                &amp;lt;img src="${image}" alt="${name}"&amp;gt;
                            &amp;lt;/div&amp;gt;
                            &amp;lt;div class="article-text"&amp;gt;
                                &amp;lt;h2&amp;gt;${title}&amp;lt;/h2&amp;gt;
                                &amp;lt;a href="${link}" class="read-more" rel="noopener"&amp;gt;Read More →&amp;lt;/a&amp;gt;
                            &amp;lt;/div&amp;gt;
                        &amp;lt;/div&amp;gt;
                    `
                })

                loader.style.display = "none"
                spotlightContainer.style.display = "flex"
            } catch (error) {
                console.error('Error details:')
                console.log(error)
                console.log('message')
                console.log(error.message)
                console.log('name')
                console.log(error.name)
                console.log('stack')
                console.log(error.stack)
                console.log('url')
                console.log(url)
                console.log('new Date().toISOString()')
                console.log(new Date().toISOString())

                console.error('Error loading spotlight content:', error)
                loader.innerHTML = '&amp;lt;p&amp;gt;Spotlight content is currently unavailable. Please check back later.&amp;lt;/p&amp;gt;'
            }
        }

        loadSpotlights()
    })
&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 May 2025 14:24:16 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Issue-with-Custom-Module-Fetching-quot-Member-Spotlight-quot/m-p/1144434#M42924</guid>
      <dc:creator>nickdeckerdevs1</dc:creator>
      <dc:date>2025-05-05T14:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Custom Module Fetching "Member Spotlight" Data on Belong.naifa.org</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Issue-with-Custom-Module-Fetching-quot-Member-Spotlight-quot/m-p/1145069#M42949</link>
      <description>&lt;P&gt;Thank you &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/115766"&gt;@nickdeckerdevs1&lt;/a&gt;&lt;/SPAN&gt; &lt;span class="lia-unicode-emoji" title=":raising_hands:"&gt;🙌&lt;/span&gt; — Jaycee&lt;/P&gt;</description>
      <pubDate>Tue, 06 May 2025 16:06:16 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Issue-with-Custom-Module-Fetching-quot-Member-Spotlight-quot/m-p/1145069#M42949</guid>
      <dc:creator>Jaycee_Lewis</dc:creator>
      <dc:date>2025-05-06T16:06:16Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Custom Module Fetching "Member Spotlight" Data on Belong.naifa.org</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Issue-with-Custom-Module-Fetching-quot-Member-Spotlight-quot/m-p/1145799#M42963</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/115766"&gt;@nickdeckerdevs1&lt;/a&gt;&amp;nbsp;, thanks for the updated code.&amp;nbsp;&amp;nbsp;I’ll test the code and let you know how it goes.&amp;nbsp;Appreciate your support!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 May 2025 03:34:20 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Issue-with-Custom-Module-Fetching-quot-Member-Spotlight-quot/m-p/1145799#M42963</guid>
      <dc:creator>soorajvtrio</dc:creator>
      <dc:date>2025-05-08T03:34:20Z</dc:date>
    </item>
  </channel>
</rss>

