Not being able to see json file updated content after deployment

Hi folks!

I’m relatively new to Netlify and I’m a junior developer who’s facing the following issue when deploying my website: I’m using a JSON file, mapping through its content and rendering the information on a specific page of my website. I recently needed to update the content of this JSON file and its new content gets rendered on my local server, however, when I deploy the website to Netlify, I keep seeing the previous content. Any idea why this might happening?

To provide more context, I’m using Astro website builder and my members.json file is located in a _ folder, which in turn is placed inside the “Public” folder.

This is how I’m fetching my data:

const membersJSON = await fetch(new URL('/_/members.json', Astro.url).href).then((response) => response.json())

const teamMembers = JSON.stringify(membersJSON) || {};

And here’s a snippet of the code I have inside members.json (removed real content for privacy):

{
  “member-a: {
    "name": “lorem” ipsum,
    "position": “CEO”,
    "bio": "<p>Lorem ipsum…</p>",
    "social": {
      "linkedin": "https://www.linkedin.com/in/…/“,
      "twitter": false
    },
    "photo": {
      "src": "/imgs/members/member-a.jpg",
      "alt": [
        “member-a.jpg"
      ]
    }
  },
  “member-b”: {
    "name": “lorem “ipsum,
    "position": "CFO”,
    "bio": "<p>Lorem ipsum…</p>",
    "social": {
      "linkedin": false,
      "twitter": false
    },
    "photo": {
      "src": "/imgs/members/member-b.jpg",
      "alt": [
        “member-b.jpg"
      ]
    }
  },
}

When I check the network and the console tabs in the developers tool on the deployed site, I can’t see any errors.

Does anyone have a suggestion regarding what may be causing this? I’ve been trying to solve this for 2 days now to no avail and thus would highly appreciate any guidance from more experienced developers.
Many thanks in advance!

Can’t check in detail without a site name, but if I were to guess:

  1. You’re using this in Astro SSR.
  2. SSR is running on Netlify Functions.
  3. Thus, you might need: How to Include Files in Netlify Serverless Functions OR simply use the absolute URL instead of /_/members.json.

Hi @hrishikesh! Many thanks for your suggestion. Quick question: given that the file is not inside the functions folder, but inside the public folder, do I need to move it to the functions folder in order to follow the suggestions on How to Include Files in Netlify Serverless Functions?

Also, in order to try your second suggestion, if my website domain was www.xyz.com, do you mean I should have this on my code instead?

const membersJSON = await fetch(new URL('https://www.xyz.com/public/_/members.json', Astro.url).href).then((response) => response.json())

const teamMembers = JSON.stringify(membersJSON) || {};

Thanks in advance!

Your code can simply be:

const membersJSON = await fetch('https://www.xyz.com/_/members.json').then((response) => response.json())