medusajs / medusa

The world's most flexible commerce platform.
https://medusajs.com
MIT License
26.23k stars 2.67k forks source link

An error occurred while processing SEARCH_INDEX_EVENT (Meilisearch) #6574

Closed kaisiant closed 9 months ago

kaisiant commented 9 months ago

Bug report

Describe the bug

Not able to create index, it stated authorization header is missing. Tried curl, it works.

System information

"@medusajs/medusa": "1.20.0", "medusa-plugin-meilisearch": "^2.0.10", meilisearch: v1.3.4

Screenshots

image

Code snippets


{
    resolve: `medusa-plugin-meilisearch`,
    options: {
      // config object passed when creating an instance
      // of the MeiliSearch client
      config: {
        host: process.env.MEILISEARCH_HOST,
        apiKey: process.env.MEILISEARCH_API_KEY,
      },
      settings: {
        products: {
          indexSettings: {
            searchableAttributes: [
              "title", 
              "variant_sku",
            ],
            displayedAttributes: [
              "id", 
              "title", 
              "variant_sku", 
              "thumbnail", 
              "handle",
            ],
          },
          primaryKey: "id",
        },
      },
    },
  },
nfzv commented 9 months ago

May I ask if you are actually providing the MEILISEARCH_API_KEY env variable?

Here are some reasons you might get this error:

  1. Using an api key header instead of Authorization header with Bearer token.
  2. Not providing any token (env variable is not set)
  3. Your Meilisearch issued api key for backend is obsolete, make sure to make GET /keys request to check if everything is alright.
kaisiant commented 9 months ago
image

May I ask if you are actually providing the MEILISEARCH_API_KEY env variable?

Here are some reasons you might get this error:

  1. Using an api key header instead of Authorization header with Bearer token.
  2. Not providing any token (env variable is not set)
  3. Your Meilisearch issued api key for backend is obsolete, make sure to make GET /keys request to check if everything is alright.
  1. I am using master key.
  2. The variable is set in railway
  3. The master key is valid, i had used it to generate api key
kaisiant commented 9 months ago

lol, the host need to include the https.