algolia
algolia copied to clipboard
fix: use `createNodeHttpRequester` for SSR execution
Types of changes
- [x] Bug fix (a non-breaking change which fixes an issue)
- [ ] New feature (a non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Description
When using the algolia search on the server a 500 server error was thrown unable to find xmlhttprequest
.
This update added a simple switch to the setup of the algoliasearch passing in the correct requester depending on if running on server of browser as detailed here: https://www.algolia.com/doc/api-client/advanced/configure-the-client/javascript/?client=javascript#requester
Checklist:
- [x] My change requires a change to the documentation.
- [x] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes (if not applicable, please state why)
Deploy Preview for nuxt-algolia-module canceled.
Name | Link |
---|---|
Latest commit | 95d4ab5506e0b562a1bbbfe37f05b909f65d0e1e |
Latest deploy log | https://app.netlify.com/sites/nuxt-algolia-module/deploys/6279768e2a262500091b36e6 |
On building on the playground there some error in the console which are also present on the browser. I was uncertain on how to fix, some guidance here would be appreciated.
[vite] error while updating dependencies:
Error: Build failed with 3 errors:
node_modules/@algolia/requester-node-http/dist/requester-node-http.esm.js:2:9: error: No matching export in "browser-external:http" for import "Agent"
node_modules/@algolia/requester-node-http/dist/requester-node-http.esm.js:4:9: error: No matching export in "browser-external:https" for import "Agent"
node_modules/@algolia/requester-node-http/dist/requester-node-http.esm.js:5:9: error: No matching export in "browser-external:url" for import "parse"
Thanks @DanielRivers for this PR.
Unfortunately I was not able to make it work. I tried to do some workaround for SSR but was still receiving the issues you mentioned. I will try some more in the upcoming days
I was not able to make this work. I also found out that SSR does not work with Instantsearch.js.