API Key Error (401)

Turns out be my error. “environment” is spelled wrong on the pinecone.init() above. that doesn’t cause an error on init - probably should - but means that environment goes to the default which is wrong for me and gets the 401 error on later calls to the api, fixing the spelling fixed the problem.

1 Like

Yes, same thing. Spelling error of the argument with no complain when executing ‘init’. Thanks for figuring out. I fixed the issue by rectifying the spelling mistake.

It’s very frustrating with pinecone. I am in a project with enterprises that would pay this service, but Pinecone seems to have a problem with their environments:

File “/data/conda-envs/bhmai1/lib/python3.9/site-packages/pinecone/manage.py”, line 185, in list_indexes
response = api_instance.list_indexes()
File “/data/conda-envs/bhmai1/lib/python3.9/site-packages/pinecone/core/client/api_client.py”, line 776, in call
return self.callable(self, *args, **kwargs)
File “/data/conda-envs/bhmai1/lib/python3.9/site-packages/pinecone/core/client/api/index_operations_api.py”, line 1132, in __list_indexes
return self.call_with_http_info(**kwargs)
File “/data/conda-envs/bhmai1/lib/python3.9/site-packages/pinecone/core/client/api_client.py”, line 838, in call_with_http_info
return self.api_client.call_api(
File “/data/conda-envs/bhmai1/lib/python3.9/site-packages/pinecone/core/client/api_client.py”, line 413, in call_api
return self.__call_api(resource_path, method,
File “/data/conda-envs/bhmai1/lib/python3.9/site-packages/pinecone/core/client/api_client.py”, line 207, in __call_api
raise e
File “/data/conda-envs/bhmai1/lib/python3.9/site-packages/pinecone/core/client/api_client.py”, line 200, in __call_api
response_data = self.request(
File “/data/conda-envs/bhmai1/lib/python3.9/site-packages/pinecone/core/client/api_client.py”, line 439, in request
return self.rest_client.GET(url,
File “/data/conda-envs/bhmai1/lib/python3.9/site-packages/pinecone/core/client/rest.py”, line 236, in GET
return self.request(“GET”, url,
File “/data/conda-envs/bhmai1/lib/python3.9/site-packages/pinecone/core/client/rest.py”, line 219, in request
raise UnauthorizedException(http_resp=r)
pinecone.core.client.exceptions.UnauthorizedException: (401)
Reason: Unauthorized
HTTP response headers: HTTPHeaderDict({‘www-authenticate’: ‘API key is missing or invalid for the environment “us-west1-gcp”. Check that the correct environment is specified.’, ‘content-length’: ‘114’, ‘date’: ‘Thu, 10 Aug 2023 06:28:13 GMT’, ‘server’: ‘envoy’})
HTTP response body: API key is missing or invalid for the environment “us-west1-gcp”. Check that the correct environment is specified.

The point is that in this prototyping phase this costs time. Money is not the problem, but I am am the senior dev for this project and “us-west1-gcp” is NOT the environment I see in the account where I am not the owner but only invited as user. What is going on here?

Sorry for the rant … but again payment is not the problem, but I don’t have the possibility to get answers, because I am not the “owner”.

And yes I checked every misspelling. I even hardcoded in the source. But to no avail :frowning:

Please, please forgive me my rant … but I have a presentation and it is stress, if I have to switch to another provider

@deniercounter did you get this working? Because if the environment setting isn’t passed, the client will default to us-west1-gcp (it was recently changed to us-east1-gcp). So that’s almost certainly what was happening here.

Also, if you’re working with a client who has their own Pinecone subscription, I suggest having them invite you to join their project as a User. This will tag your account as having the same level of support access they enjoy so that you can get faster responses at support.pinecone.io. They can easily remove your access once the project is done.