-
Notifications
You must be signed in to change notification settings - Fork 39
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
Caching issue with Next.js and Turso dev server #225
Comments
i use the turso dev command to launch the dev server for the database alongside nextJS. i do call the db from a react server component, but I got this error. Error: Unexpected non-whitespace character after JSON at position 308 (line 15 column 2) |
I've been getting the I'm not sure if this is related to setting
Separately, it seems like this pr was maybe started to address this? I'm not familiar with hrana, so I may be off target there |
I was experiencing the same - only work around was to downgrade @libsql/client to 0.5.6 as mentioned above. My deployment to Vercel works fine, and I only experience the error running locally with version ^0.6, but this is because my deployed version is referencing a Turso DB rather than a local libsql instance. |
OMG I looking for a solution to this problem for few hours, this error is ridiculous. Thanks a lot for your help! |
It takes hours to understand why this is not working on vercel, but working locally. looks like until nextjs 15 is not released - this should be a part of my config |
Thank you so much for sharing this! I have been puzzled by this behavior for half an hour - the local data was stale, but when I run on the server, it would work fine. I tried this noCache config and it fixed the issues. |
Probably this won't be needed anymore with Next.js 15 due to the new opt-in for caching, I hope. So closing this now. Please add a comment if the problem still arises with version 15. |
Discovered a strange behavior inside a Next.js application together with Turso dev server (using http url).
Issue: New entries where not returned from a query.
After a lot of digging, I discovered a directory named fetch-cache and saw that there are the requests to Turso cached. Deleting this directory solved the issue temporarily as the new records where returned from the query thereafter.
To fix the problem, a parameter
{ cache: 'no-store' }
should be included with the fetch call. (More info in the Next.js documentation here)I could fix this locally by adding a custom fetch function to my config:
But I feel it would be better to include this in the library as default to avoid this problem to future users. What do you think?
The text was updated successfully, but these errors were encountered: