I’ve had a hell of a time getting anything to work, and have abandoned using the javascript package in favor of going straight to the REST API but I can’t even get that working. I don’t know if this header is correct and its not clear to me if the example in the docs are actually the correct header properties or not. I am using this: (of course MY KEY is a string). I lifted the url and the key from the Pinecone Console.
async query(queryVector) {
await fetch(‘https://test-404b8e3.svc.northamerica-northeast1-gcp.pinecone.io/query’, {
method: ‘POST’,
mode: ‘no-cors’,
headers: { ‘Accept’: ‘application/json’,
‘Content-Type’: ‘application/json’,
‘Api-Key’: MY KEY,
},
body: JSON.stringify({
namespace: ‘dss’,
topK: 3,
includeMetadata: true,
vector: queryVector
})
}).then(response => { return response.json() })
.then(data => { console.log(data) })
},
and I get this 401 error:
API key is missing or invalid for the environment “northamerica-northeast1-gcp”. Check that the correct environment is specified.
I am not sure “Api-Key” is the right property, or even other properties are needed in the header, or what it is.
Any help appreciated, thanks.