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
NODE_TLS_REJECT_UNAUTHORIZED
environment variable and set its value to
"0"
. 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'] {
...,
author->,
categories[]->
} | order(_createdAt desc)
`;
export default async function HomePage() {
if (previewData()) {
return<div>Preview mode</div>;
}
const posts = await client.fetch(query);
console.log(posts)
return (
<div>
<h1>Not in preview mode</h1>
</div>
);
}