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.

Powered by Struct AI
Dec 14, 2021 (23 months ago)
Photo of md5-fa83de4db3e1444aecaf7a587e35eb16
09:13 PM
Hi, I'm evaluating Typesense for a SaaS product ... I have read the docs, signed up for Typesense Cloud since I don't want to host ... but in following the docs to initialize the client I cannot make a search request to the server because of a CORS error.

If 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).
Photo of md5-8813087cccc512313602b6d9f9ece19f
09:53 PM
Darren We do have CORS enabled for Typesense Cloud clusters. Could you share a screenshot of the browser console showing the console with the error and the network tab showing the requests?