Api calls and assets loading

Hi, I want to know something.
I have a page built using nextjs (it’s already pre-rendered), and it has a lot of images loaded from Dato, the images are fetched on build time by the graphql api.
Every time that I reload the page, I see the Top requested assets section (inside Project usage) with more api calls, I thought that once the page is built, I won’t need to load the images again on every requests.

So my question is: Every time that I reload the page and therefore I’m adding api calls to the assets section, am I also adding api calls to the API requests section and using the full-access token?

Any news on this?

Hey @julian1, in NextJS:

  • if you’re using getStaticProps, the GraphQL API calls are only made at build time, but if you’re using ie. getServerSideProps, they’re repeated for every visit, so it actually depends on your code!
  • as for the actual images, every visitor downloads them, so everyone contributes to the total consumed traffic!

Hi, thank you for replying. All of my pages use getStaticProps and getStaticPaths. And I see everyday some pages with a lot of GraphQL API calls (you can see it in the picture), and these pages shouldn’t take more than 10 requests to get built. And I repeat, this picture it’s only for today, you can imagine what happens if I have that amount of requests the entire month…

So, can you tell me somehow why these pages have so many requests? I added different API Tokens and the referer header so I can track the requests, but it’s weird to have that amount of requests

Can you give me a response please?

Hello @julian1 , i’m so sorry for the delay i must have missed this thread

If you are having several requests a day, even on days that you are not building your website, and you are using the client to make requests exclusively through getStaticProps then the request number shouldn’t be going up that much daily indeed.
What could be happening is:

  • The API token is being used in some other project
  • The client inside that project is making requests outside of getStaticProps (on client-side or server-side through getServerSideProps

To make sure the first item is not happening regenerating the API Token is a good way to rule out unintended use of the API token, and analysing the code throughly will make sure that requests are only being made on getStaticProps.

Since you’ve said you’ve regenerated the token already and you are still getting those unexpected calls, could you invite me to the github repository of this project so i can take a closer look at it and do some testing on our end? I’m @marcelofinamorvieira on github.