meilisearch / meilisearch-js

JavaScript client for the Meilisearch API

Home Page:https://www.meilisearch.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Auth Header required Error , even when api key is provided

Suksham-sharma opened this issue · comments

so i was using meilisearch with nestJs , i hosted it on Azure , but i was get auth header missing error , i seeked support on discord .

The main issue is when i open the hosted instance on azure directly , on web and then enter api key , it works fine , and the system also works on localhost , but on azure hosted , when i send a request , i get missing auth header in nestJs

this._client = new MeiliSearch({
      host: 'myAzureUrl',
      apiKey: 'myApiKey',
    });

This is the way i'm providing ApiKey and Url , Please Check
image

Hey

Looks like your issue is more related to a support need and not a request for feature or a bug fix.

You might have noticed when opening the issue we don't do support in this repo anymore.

Capture d’écran 2023-10-11 à 16 56 38

We are a small team, so we can’t spend much time doing support this specific repo anymore 😢 Plus I'm not sure this issue is related to this client since it works locally.

I would recommend going to our Discord instead. The community will be able to help you, no matter your question.

Thanks for using Meilisearch!

I'm having the same issue. If I curl with the API key, the request works. When I use the node sdk and provide the same api key, I receive this error.

Using v0.37.0

In this case, can someone provide a reproducible example?

Also, any fix will be welcome 🙏

Do you have the same issue a previous release of meilisearch-js?

I've tried all versions from 0.24.0 to 0.37.0 and have the same issue with all of them.

Some more context:

I'm running the self-hosted version of meilisearch using Docker on AWS ECS. It was working yesterday, but after redeploying today, I'm now receiving the Authorization header error.

If I switch my host & key to a meilisearch cloud project instead of my self-hosted server, it works as expected.

It works fine when you use it locally even with the Api-Key ,but somehow not works with same approach on Azure

If it work fine locally, definitely it's not related to this client to me.

I'm running the self-hosted version of meilisearch using Docker on AWS ECS. It was working yesterday, but after redeploying today, I'm now receiving the Authorization header error.

Hard to debug without more information 😬 What did you changed in the deployment? Did you upgrade to a new Meilisearch version?

I think both of you could find more help & support on our Discord

I didn't change anything. I just redeployed the same docker image getmeili/meilisearch:v1.5

I can DM you the url and api key for the server if it's helpful for testing

Are you using full url for the host ? , I was using it directly without http / https , it was taking it http on its own , and was causing the issue , changing it https made it right , so please check if this minor thing helps @ericc59

I am using the full url for the host

I'm still not able to reproduce the bug, we need a reproducible example as asked here, otherwise it's impossible to debug, so to fix 😢

@curquiza I just looked into this again and it turns out I'm an idiot and wasn't providing the full host url.

You may want to consider adding a warning or error if the provided host is missing the scheme.

To reproduce, just remove https:// from the host and you should see the authorization header error.

mentioned it in the documentation issues , so it could be updated there

Thanks @ericc59 for coming back to us with the information 😊

Thanks @Suksham-sharma for the help and the issue on the docs side. The maintainer of the docs will take this into account.

Closing this issue then, since an issue is in the docs now