Hi - am getting this error using the node.js library as follows:
async function search(searchQuery) {
const request = {
pageSize: 10,
query: searchQuery,
servingConfig: `projects/${config.gcp.project_id}/locations/${config.gcp.location}/collections/${config.gcp.collectionId}/dataStores/${config.gcp.dataStoreId}/servingConfigs/${config.gcp.servingConfigId}`,
};
const IResponseParams = {
ISearchResult: 0,
ISearchRequest: 1,
ISearchResponse: 2,
};
// Perform search request
try {
const response = await client.search(request, {
autoPaginate: false,
});
const results = response[IResponseParams.ISearchResponse].results;
for (const result of results) {
console.log(result);
}
return results;
} catch (error) {
console.log(error);
return (error)
}
}
I've confirmed that the path is correct. And i've got it working via postman.
I've also noticed that the node example uses projectId, but what's working via the postman request uses project number instead of projectId. I interchanged that in the code above, but still same error.
Any thoughts?
----
later
---
figured it out was just something stupid - my configs weren't loaded properly at this point: so the location was not defined correctly.
let location;
const apiEndpoint =
location == 'global'
? 'discoveryengine.googleapis.com'
: `${config.gcp.location}-discoveryengine.googleapis.com`;