Closed lihbr closed 1 year ago
Makes sense to me!
Should there be a way to suppress the warning if the user truly wants to avoid cached requests? Adding a public option for that would be odd in my opinion since it is a development-only feature; it would pollute the API for everyone, despite only being applicable for a very small subset of users and only valid in a certain environment.
An environment variable probably wouldn't work well since process.env
may not exist and we don't have access to static values like a bundler would have.
Kinda silly, but maybe we could detect if the API endpoint includes a URL param? Like: ignore-cdn-warning=true
I cannot think of a valid use case to bypass the CDN, if there's one it's maybe more of a bug on our CDN we need to fix. This is just a development warning, anyway, so I'm more into a "wait & see" approach to see if we need to have a way to disable that.
Works for me! And you're right; there shouldn't be a reason to disable the CDN (which makes me wonder… why do we even offer a non-CDN API?).
Is your feature request related to a problem? Please describe.
Developer experience
Describe the solution you'd like
I think we should emit a warning in development when users init the client with an endpoint on
.prismic.io
domain instead of.cdn.prismic.io
: https://github.com/prismicio/prismic-client/blob/v7/src/createClient.ts#L473Describe alternatives you've considered
Doing nothing.
Additional context
Non
.cdn
calls are less performant and not tracked the same way within the API