Issue with private dataset in NextJS and how to handle environment variables.
Last updated: Sep 7, 2023
Hi everyone! I’m having issues with a private dataset in NextJS. I can see the studio content populating my site on localhost with a public dataset, but not when I turn it to private.
I have added a SANITY_API_READ_TOKEN in my .env.local
What am I missing?
Sep 7, 2023, 7:32 PM
👋 Your Next build won’t be able to pick up Sanity-specific env vars with that prefix. That method only works in a standalone Sanity instance. You shouldcheck out the Next documentation for how best to handle it.