Hi all, I'm integrating Sanity into a Next.JS project but I'm not able to get a basic query working, even though it works in Vision. The error I get is strange and unhelpful:
Unhandled Runtime Error
Error: expected ']' following array body
Here's the code to fetch and display an 'article' page:
import { SanityDocument } from "@sanity/client";
import Article from "@/components/Article";
import { articlePathsQuery, articleQuery } from "@/sanity/lib/queries";
import { client } from "@/sanity/lib/client";
export default async function ArticlePage({params}) {
const article = await client.fetch({articleQuery, params})
return <Article article={article} />;
}
And here's my query:
`export const articleQuery =
*[_type == "article" && slug.current == $article_id][0]{
_id,
title,
author,
content,
slug
`}`;`
Any thoughts/suggestions are much appreciated :)