Lucie
Lucie
NNuxt
Created by sylr on 1/8/2025 in #❓・help
@nuxtjs/prismic high API usage
Got the invite, I'll have a look at it during the afternoon 🙂
44 replies
NNuxt
Created by sylr on 1/8/2025 in #❓・help
@nuxtjs/prismic high API usage
Sure thing, let me know! You can either share a zip at lucie.haberer@prismic.io, or invite me temporarily on your GitHub (if using GitHub) with @lihbr
44 replies
NNuxt
Created by sylr on 1/8/2025 in #❓・help
@nuxtjs/prismic high API usage
Would you like me to have a look at your source code (if you're comfortable sharing it)? Happy to
44 replies
NNuxt
Created by sylr on 1/8/2025 in #❓・help
@nuxtjs/prismic high API usage
On the other hand, I would dig into the 7 million calls thing because that sounds really weird to me, maybe it's not the homepage or some other page that burst many calls(?)
44 replies
NNuxt
Created by sylr on 1/8/2025 in #❓・help
@nuxtjs/prismic high API usage
Prismic API's cached on Cloudflare CDN and invalidated when new content is published on Prismic. If you want to cache results on Nuxt's end I would look into Hybrid Rendering as suggested above: https://nuxt.com/docs/guide/concepts/rendering#hybrid-rendering, @nuxtjs/prismic itself doesn't provide another caching mechanism as those often don't play well with content update
44 replies
NNuxt
Created by sylr on 1/8/2025 in #❓・help
@nuxtjs/prismic high API usage
OK, there's definitely something to worry about and worth investigating then, my bad!
44 replies
NNuxt
Created by sylr on 1/8/2025 in #❓・help
@nuxtjs/prismic high API usage
OK, yes! This sounds all possible then with the setup you shared to me (usePrismicSlicesResolver might make a few extra calls based on resources needed by your slices that your developers implemented). With that in mind I don't think there is anything wrong with your code (like crazy process loops or else), and making ~8 calls to fetch the resources to render your pages sounds alright and typical when augmenting your slices content with extra data. Those calls are also made concurrently which is great to improve your website's speed. I wouldn't be surprised then if you see your API usage being ~10x your actual website traffic and our API should handle the load without issues (most of them should be cache hit on Cloudflare sitting in front of our API) If API usage becomes a concerns of your, you could look into Nuxt's hybrig rendering feature (https://nuxt.com/docs/guide/concepts/rendering#hybrid-rendering) which could allow you to cache or make static some pages that aren't so dynamic, preventing you from querying Prismic on every visit
44 replies
NNuxt
Created by sylr on 1/8/2025 in #❓・help
@nuxtjs/prismic high API usage
But I think this function or its resolvers might be making a lot of Prismic calls for some reasons
44 replies
NNuxt
Created by sylr on 1/8/2025 in #❓・help
@nuxtjs/prismic high API usage
Thanks! I'm not sure this is the one though 🤔 (this function requires 3 arguments while the one in the first snippet your shared only use 2, and I don't think the usage is the same, but maybe I'm really wrong)
44 replies
NNuxt
Created by sylr on 1/8/2025 in #❓・help
@nuxtjs/prismic high API usage
Are you able to locate the code behind usePrismicSliceResolver perhaps? It could help I think
44 replies
NNuxt
Created by sylr on 1/8/2025 in #❓・help
@nuxtjs/prismic high API usage
✅ template is alright (just wanted to check if it was multiroot (which is not supported by Nuxt) or not)
44 replies
NNuxt
Created by sylr on 1/8/2025 in #❓・help
@nuxtjs/prismic high API usage
The code above looks fine, I see it making at least 2 Prismic calls (one fetchSingle and one getByType), and potentially more within the usePrismicsliceResolver
44 replies
NNuxt
Created by sylr on 1/8/2025 in #❓・help
@nuxtjs/prismic high API usage
Awesome, thanks! Do you have the template part of the page you shared above also?
44 replies
NNuxt
Created by sylr on 1/8/2025 in #❓・help
@nuxtjs/prismic high API usage
If you don't have access to the source code, do you notice those call spikes appearing on every page or just some ? While doing something in particular ?
44 replies
NNuxt
Created by sylr on 1/8/2025 in #❓・help
@nuxtjs/prismic high API usage
Oh, sure! Do you have access to the site's source code? If yes, I'd like to know on your Nuxt pages, for example ~/pages/index.vue, how data from Prismic are queried, there should like be something like useAsyncData or at least prismic.client.* somewhere. If you could share what the code looks like around those that'd be helpful 🙂
44 replies
NNuxt
Created by sylr on 1/8/2025 in #❓・help
@nuxtjs/prismic high API usage
Hi @sylr, this sounds unexpected, can you share more details about your setup? Especially how you query data
44 replies
NNuxt
Created by Pin 8 on 6/17/2023 in #❓・help
Modifying code in a composable throws error 500 composable is not defined
3 replies
NNuxt
Created by Pin 8 on 6/17/2023 in #❓・help
Modifying code in a composable throws error 500 composable is not defined
Hey Pin, I thought I was going crazy over a mistake of mine, but I'm experiencing the same issue here, you're not alone ^^ I've tried to look about it for a bit: - Doesn't seems like a regression, tried on 3.5.3 (latest), 3.5.0, 3.4.3, 3.3.3 without luck - Doesn't seems like something on unimport, tried with dependency overrides from 3.0.0 to 3.0.8 - Doesn't seem related to top-level App.vue, same when using page directory I'll see with the team what's going on here, I still feels like it's something silly, but I'll open an issue if it leans towards a real issue 🤔
3 replies