See Sanity in action 👀 Join us for a live product demo + Q&A →

Issue with Sanity Client Lib and SSL verification

6 replies
Last updated: Feb 17, 2023
Hello, I am having an issue the Sanity Clien Lib I think. Whenever I run the code below I get "Unhandled Runtime Error
Error: unable to get local issuer certificate " From googling it sounds like a potential is to add the
environment variable and set its value to
. But this will disable SSL verification for all requests, which is not a secure solution. I was wondering if there were any other solutions? import { previewData } from "next/headers";import { groq } from "next-sanity";
import { client } from "../../lib/sanity.client"

const query = groq`
*[_type=='post'] {
} | order(_createdAt desc)

export default async function HomePage() {
if (previewData()) {
return<div>Preview mode</div>;


const posts = await client.fetch(query);

return (
<h1>Not in preview mode</h1>

Feb 17, 2023, 1:38 PM
Are you on a network that’s using a firewall or proxy?
Feb 17, 2023, 4:54 PM
Feb 17, 2023, 5:51 PM
That’s what’s causing your issue.
Feb 17, 2023, 5:52 PM
Ok, thanks!
Feb 17, 2023, 5:52 PM
I will speak with IT
Feb 17, 2023, 5:52 PM
Feb 17, 2023, 5:53 PM – build remarkable experiences at scale

Sanity is a customizable solution that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.