Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Algolia Search Proxy Endpoint #343

Merged
merged 1 commit into from
Aug 16, 2023
Merged

Conversation

calebjacob
Copy link
Collaborator

Closes: https://pagodaplatform.atlassian.net/browse/DEC-1402

After talking with @pkudinov, we agreed that it made sense to implement a proxy endpoint POST /api/search that can be used by VM components - this will hide the secrets from the frontend. The "App Store" will be the first feature using this endpoint to support searching for apps.

Inside a VM component, you can access the search endpoint:

asyncFetch("/api/search", {
    body: JSON.stringify(body),
    headers: {
      "Content-Type": "application/json",
    },
    method: "POST",
  }).then(...).catch(...);

I've already gone ahead and added the new ENV variables to Vercel for all of our gateway environments. Right now there's only a MAINNET indexer, but we can easily update the beta.near.org ENV variables to use a TESTNET version whenever it's ready.

@vercel
Copy link

vercel bot commented Aug 16, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
near-discovery ✅ Ready (Inspect) Visit Preview Aug 16, 2023 5:02pm
near-discovery-testnet ✅ Ready (Inspect) Visit Preview Aug 16, 2023 5:02pm

@mpeterdev
Copy link
Collaborator

is this necessary? This section of their docs suggests that a search API key is not sensitive and can be included in frontend code

https://www.algolia.com/doc/guides/security/api-keys/#search-only-api-key

@pkudinov
Copy link

We would like to use search in multiple different components, including in externally owned components, and given that we are not sure about Algolia long-term, we want to make sure we have an easy way to swap the search. In addition, if we decide to upgrade or rebuild search index, the URL will change, requiring all components (including externally owned) to update

@calebjacob calebjacob merged commit dc58aa1 into develop Aug 16, 2023
3 checks passed
@calebjacob calebjacob deleted the feat/search-proxy-endpoint branch August 16, 2023 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants