Error with Sanity Data Fetcher and slug param.

Hi , I am using Sanity as my CMS.I am using Sanity Data fetcher with the following GROQ query:

*[_type == "page" && slug.current == "${$ctx.params.slug}"][0] {

I like to get different page based on the slug param but so far I was not able to do that. I am getting Error in sanity Fethcer: slug is not defined. I was wondering if I am doing anything wrong?

Are you using a “dynamic expression” (shows up in a white pill with green color font in the UI) for defining that query?

I write by hand

and set it to dynamic value

Can you share a screenshot showing how it’s configured and where you are seeing this error?

Hi, I just messaged you regarding this and other issues that we have :slight_smile:

I was able to solve the issue. Sanity fetcher expect to receive and array, but in my GROQ query I was asking to send only one object

*[_type == "page" && slug.current == "${$ctx.params.slug}"][0] 

Removing [0] solved the issue

Terrific to hear!