-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with Next.js revalidation #1599
Comments
Okay I have narrowed this issue down to this setting in the next-sanity package of the client. fetch.ts return client.fetch<QueryResponse>(query, params, {
stega,
perspective: "published",
// The `published` perspective is available on the API CDN
useCdn: true,
// Only enable Stega in production if it's a Vercel Preview Deployment, as the Vercel Toolbar supports Visual Editing
// When using the `published` perspective we use time-based revalidation to match the time-to-live on Sanity's API CDN (60 seconds)
next: { revalidate: 60 },
// The token is required as we are using a private dataset
token,
}); The only time I get good data is setting |
Thank you for making the effort to create a good repro for this. We'll have a look as soon as we get our hands free. |
@evenwestvang I am seeing issues that surround GROQ
Example in Next.js not returning this field Vision returns all of the data correctly, I am wondering if this could cause any of the whitespace as well, or if something isn't correct with the JSON. Since I have images all over the site from Cloudinary I obviously would see all the issues mentioned above. ![]() Full JSON of the result from vision query-result.json |
Some more groq tests with cloudinary becoming an issue. I will also add that even if I try to just use the below it still goes missing inside of Next.js.
with-cloudinary.json - missing entries Again with these in vision or CLI it works. |
okay all of what I thought were issues with cloudinary.asset was not, it appears that is all due to a problem using taint. simple repo: https://github.com/codercatdev/next-sanity-cloudinary-issue ![]() This shows how the logger displays when using taint vs. the data actually appearing on the page. These two things DO NOT match. The issue with |
I will pay for support to get this working @evenwestvang @kmelve is there someone I can do a call with to get this working. It is forcing me out of static and only allowing for a lambda based site, which I was hoping to avoid. |
@codercatdev is this issue still for grab? |
@Shub3am yes it should be, if you can't repro let me know and I will make sure that branch is usable for the issue. |
Sure, I am taking this one |
Any workaround to this issue? |
My only workaround was to stop generating anything statically. Not really a great workaround but for now that is what I have. So all of https://codingcat.dev is on demand. |
Same here, I only get this in dev environment
…On Fri, 26 Jul 2024, 11:41 am Dante, ***@***.***> wrote:
This only affects me during dev, not production. However none of the
workaround are working for me.
—
Reply to this email directly, view it on GitHub
<#1599 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHXXP7FD34ZRJA7VGKESXY3ZOIRVZAVCNFSM6AAAAABJQDXA62VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJSGQ4DKNJQG4>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
We are running into this same issue running app router and 15.0.4. @codercatdev did you ever figure out what was going on? We found a workaround by wrapping the whole thing in |
Unfortunately no 😔
…On Fri, Jan 17, 2025, 7:54 PM Justin Adkins ***@***.***> wrote:
We are running into this same issue running app router and 15.0.4.
@codercatdev <https://github.com/codercatdev> did you ever figure out
what was going on? We found a workaround by wrapping the whole thing in
unstable_cache and using its revalidation logic instead. That has seemed
to work but seems silly since its baked into fetch.
—
Reply to this email directly, view it on GitHub
<#1599 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXVMKN34WBU7XI47DRKJ532LGQ5LAVCNFSM6AAAAABVM7OPWOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKOJZGQZTENBXGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Describe the bug
https://sanity-io-land.slack.com/archives/C9Z7RC3V1/p1718675586121679
I am getting
Failed to parsed response body as JSON: Unexpected non-whitespace character after JSON at position 820
on production builds of my site. On the build that was successful to production and currently live, if I try to rebuild it throws these errors now.I am using Next.j 14.2.3.
fetch.ts
client.ts
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I would expect JSON not to contain any extra whitespace.
Screenshots
Which versions of Sanity are you using?
@sanity/cli (global) 3.46.1 (up to date)
@sanity/assist 3.0.4 (up to date)
@sanity/code-input 4.1.4 (up to date)
@sanity/icons 3.2.0 (up to date)
@sanity/image-url 1.0.2 (up to date)
@sanity/preview-url-secret 1.6.17 (up to date)
@sanity/ui 2.4.0 (up to date)
@sanity/vision 3.46.1 (up to date)
@sanity/webhook 4.0.4 (up to date)
sanity 3.46.1 (up to date)
What operating system are you using?
Mac 14.5 (23F79)
Which versions of Node.js / npm are you running?
10.8.1
v22.3.0
Additional context
I thought at first this was a stega issue as it seems to be related, but if I fetch with stega:false it still happens. Setting next:revalidate to 0 is the only thing that I found works.
The only change from the example is that when using the "published" perspective I also pass token as my dataset is not public.
The text was updated successfully, but these errors were encountered: