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

Netlify edge build SSR request fails #196

Open
plexus77 opened this issue Apr 11, 2024 · 4 comments
Open

Netlify edge build SSR request fails #196

plexus77 opened this issue Apr 11, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@plexus77
Copy link

Version

@nuxtjs/algolia: 1.10.2
nuxt: 3.11.2

Reproduction Link

Don;t have time to reproduce on netlify and have fixed the issue since then

Steps to reproduce

Use one of the composables useAlgoliaSearch to perform a search, locally works fine. On netlify SSR fails but client side works.

What is Expected?

SSR Works

What is actually happening?

Not sure what is going on internally with the requests but putting the useFetch config option to true fixes the issue.

Wasn't sure if this is a bug in the module or underlying algolia library but it took me a while to figure out so thought I would put it here.

@plexus77 plexus77 added the bug Something isn't working label Apr 11, 2024
@Baroshem
Copy link
Collaborator

Hey Buddy,

Thanks for reporting this issue.

However, I am not sure if I will be able to help. Could you provide more details like reproduction link or at least the error your got?

Then, I will be happy to help :)

@remihuigen
Copy link

I think i'm running into the same issue with Cloudflare workers. useAlgoliaSearch() works fine client side, but not on the server.

Have an app deployed with nuxt hub, which currently doesnt have the best debug experience, so i cant access any errors from server logs.

I thought it migth have something to do with the requester. I know that @algolia/requester-node-http is not available in edge runtimes, but setting runtimeConfig.public.algolia.useFetch = true did not solve the issue

nuxtApp.$algolia.transporter.requester = (await import('@algolia/requester-node-http').then(lib => lib.default || lib)).createNodeHttpRequester()

I'll try to do some more digging into the cause next week

PS. I know algoliasearch v5 has some improvements regarding edge runtimes, upgrading to the latest major version of the client might resolve the issue. I have another project running on CF which uses the algolia client (v5) directly, and the search method works out of the box

@Baroshem
Copy link
Collaborator

Baroshem commented Nov 4, 2024

Hey there, for the server side usage, I recommend using useAsyncAlgoliaSearch composable that does exactly what you did under the hood :)

@remihuigen
Copy link

Yes, but that one still doesn't work... I think I'm going to switch to the latest algolia client itself, since I'm not really using anything other then searchIndex() and multipleQueries().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants