Search function error

I am trying to create a site search function as specified in the documentation, but I always get the error “MISSING_BUILD_TRIGGER_ID_PARAMETER”. But I use this parameter. Tell me what could be the problem?

<script setup>
import { useSiteSearch } from "vue-datocms";
import { buildClient } from "@datocms/cma-client-browser";
const client = buildClient({ apiToken: "api_token" });

const { state, error, data } = useSiteSearch({
  client,
  buildTriggerId: "25942",
  // optional: by default fuzzy-search is not active
  fuzzySearch: false,
  // optional: you can omit it you only have one locale, or you want to find results in every locale
  initialState: { locale: "en" },
  // optional: defaults to 8 search results per page
  resultsPerPage: 9,
});
</script>

Hello @ggavrilov

The second toggle in the webhook should be enabled “Enable Site Search”, after enabling and saving it, you should trigger a build on that build trigger to also allow a site-spidering to occur upon build completion. After that spidering is done, the search request will work as expected.

1 Like