Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The provided API key is invalid when using $meilisearch #131

Open
Rednas83 opened this issue Aug 19, 2024 · 2 comments
Open

The provided API key is invalid when using $meilisearch #131

Rednas83 opened this issue Aug 19, 2024 · 2 comments

Comments

@Rednas83
Copy link

This is strange because useMeiliSearch("movies") is working without errors.

Is perhaps an adminApiKey required or is there something else wrong with $meilisearch

server/api/search/add/[document].ts

export default defineEventHandler(async (event) => {
  const addRecordRes = await $meilisearch.index("movies").addDocuments([
    {
      id: 999999994234,
      title: "Batman Unmasked: The Psychology of the Dark Knight",
      poster: "https://image.tmdb.org/t/p/w1280/jjHu128XLARc2k4cJrblAvZe0HE.jpg",
      overview: "Delve into the world of Batman and the vigilante justice tha",
      release_date: "2008-07-15",
    },
  ])

  return { myCustomResponse: "Document is on the way....", addRecordRes }
})
@Rednas83
Copy link
Author

Fixed it by copying the searchApiKey to the adminApiKey.

Looks like the local server only uses a single master key for adding and searching
image

Perhaps make the adminApiKey default for users that run mellisearch locally?

@xlanex6
Copy link
Owner

xlanex6 commented Aug 28, 2024

Hi @Rednas83

Why not? Can you suggest a PR?

Keep in mind that search and admin keys give more flexibility on roles and permissions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants