nuxt-meilisearch icon indicating copy to clipboard operation
nuxt-meilisearch copied to clipboard

$meilisearch is not defined

Open alex3025 opened this issue 10 months ago • 0 comments

When I run this code in my <script setup>:

const { availableIndexes, error } = await useAsyncData(async () => {
  const rawIndexes = await $meilisearch.getIndexes();  // This triggers the error
  return rawIndexes;
});

I get the following error:

ReferenceError: $meilisearch is not defined
    at http://localhost:3000/_nuxt/components/Search/IndexSelector.vue?t=1713863629542:30:26
    at Promise.then.result (http://localhost:3000/_nuxt/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected][email protected]_es_vs5t26qmp4vt6ccneqoti2yifm/node_modules/nuxt/dist/app/composables/asyncData.js?v=34b5c8a1:69:19)
    at new Promise (<anonymous>)
    at asyncData.refresh.asyncData.execute (http://localhost:3000/_nuxt/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected][email protected]_es_vs5t26qmp4vt6ccneqoti2yifm/node_modules/nuxt/dist/app/composables/asyncData.js?v=34b5c8a1:66:21)
    at initialFetch (http://localhost:3000/_nuxt/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected][email protected]_es_vs5t26qmp4vt6ccneqoti2yifm/node_modules/nuxt/dist/app/composables/asyncData.js?v=34b5c8a1:107:40)
    at useAsyncData (http://localhost:3000/_nuxt/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected][email protected]_es_vs5t26qmp4vt6ccneqoti2yifm/node_modules/nuxt/dist/app/composables/asyncData.js?v=34b5c8a1:141:7)
    at http://localhost:3000/_nuxt/components/Search/IndexSelector.vue?t=1713863629542:28:94
    at withAsyncContext (http://localhost:3000/_nuxt/node_modules/.cache/vite/client/deps/chunk-YWILYD4D.js?v=34b5c8a1:4817:19)
    at setup (http://localhost:3000/_nuxt/components/Search/IndexSelector.vue?t=1713863629542:28:64)
    at callWithErrorHandling (http://localhost:3000/_nuxt/node_modules/.cache/vite/client/deps/chunk-YWILYD4D.js?v=34b5c8a1:1659:19)

alex3025 avatar Apr 23 '24 09:04 alex3025