CORS Error When Making Search Request on Typesense Cloud
TLDR Darren is trying to use Typesense for a SaaS product but is encountering a CORS error. Jason asks for screenshot to provide further assistance.
Dec 14, 2021 (23 months ago)
Darren
09:13 PMIf I debug the client.collections('companies') I do have an object with a documents method, which returns an object with the search method ... but calling search triggers the CORS error
Request #1639516313850: Performing GET request: /collections/companies/documents/search ApiCall.ts:98:16
Request #1639516313850: Nodes Health: Node 0 is Unhealthy ApiCall.ts:230:16
Request #1639516313850: Node 0 has exceeded healtcheckIntervalSeconds of 2. Adding it back into rotation. ApiCall.ts:256:18
Request #1639516313850: Updated current node to Node 0 ApiCall.ts:240:20
Request #1639516313850: Attempting GET request Try #1 to Node 0 ApiCall.ts:101:18
Request #1639516313850: Request to Node 0 failed due to "undefined Network Error" ApiCall.ts:191:20
Request #1639516313850: Sleeping for 0.1s and then retrying request... ApiCall.ts:197:20
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://1.a1.typesense.net/collections/companies/documents/search?x-typesense-api-key=rcYaLUfPrXhPmVNiZUvTy138HjoFzSgD. (Reason: CORS request did not succeed). Status code: (null).
Jason
09:53 PMTypesense
Indexed 2776 threads (79% resolved)
Similar Threads
Troubleshooting TypeScript Error with Typesense
GM experienced an error with Typesense in TypeScript, requiring help to correct the issues. Jason helped propose solutions and adjustments to the code. Ultimately, they were able to resolve the errors and successfully implement a search function.
Fixing Corrupted Documents and Upgrading Typesense Cloud Version
gab had issues with corrupted documents in Typesense Cloud. Jason suggested upgrading to version 0.24.1.rc, which resolved the issue. They also discussed CORS domain management.
Resolving CORS-related Issues with Typesense Server
Edson experienced typesense-related CORS issues, which Jason solved by advising to add the `--enable-cors` flag during the startup of the typesense server. The difference in how typesense instantsearch adapter works was also clarified.