typesense / typesense-dart

Dart client for Typesense
https://typesense.org/docs
Apache License 2.0
73 stars 16 forks source link

XMLHttpRequest error while using http post flutter web #143

Open deniscass opened 6 months ago

deniscass commented 6 months ago

Describe the bug

I`m attempt use a self installed typesense server to get better search in my Flutter web project. Is a simple personal project to start learning about typesense. But i get issues to get server access in my flutter web lcoalhost develop machine. with a generic error:

XMLHttpRequest error in search and crud operations to add content to index search. I`m using Postman client to test my server and all wordks fine, but in Flutter web no. I check api keys, SSL cert with Letsencrypt certificate, and no work.

I attempt use enable-cors and disable it too, but no working too.

Some tips to get search and upsert functions working?

Thanks in advance

Steps to reproduce the behavior:

  1. Follow steps in pub.dev/typesense
  2. Install typesense-serve in Ubuntu server linux
  3. Setup a new flutter project
  4. Atempt start search or add data to typesense from flutter web
happy-san commented 6 months ago

Hello @deniscass Did you use this guide to install typesense? https://typesense.org/docs/guide/install-typesense.html#deb-package-on-ubuntu-debian

You will have to enable CORS typesense instance https://typesense.org/docs/26.0/api/server-configuration.html#cors

deniscass commented 6 months ago

Hi Harpreet, Thanks in advance for help-me. I use this same guide. I enable CORS and set cors-domains to * and enable Lets encrypt ssl. With postman and curl works fine and very fast. Great features from TypeSense over ElasticSearch.

I try api-key and can request all actions, for example, from Postman and Curl , i can:

But in my Flutter web app no work nothing. I debut until underground functions in dart SDK that create and send requests and validade all parameters, security, ssl and body content and no issues, but HTTP Response is same XMLHttpRequest.

Obter o Outlook para iOShttps://aka.ms/o0ukef


De: Harpreet Sangar @.> Enviado: Thursday, May 2, 2024 11:43:05 AM Para: typesense/typesense-dart @.> Cc: Denis Rodrigues Cassiano @.>; Mention @.> Assunto: Re: [typesense/typesense-dart] XMLHttpRequest error while using http post flutter web (Issue #143)

Hello @deniscasshttps://github.com/deniscass Did you use this guide to install typesense? https://typesense.org/docs/guide/install-typesense.html#deb-package-on-ubuntu-debian

You will have to enable CORS typesense instance https://typesense.org/docs/26.0/api/server-configuration.html#cors

— Reply to this email directly, view it on GitHubhttps://github.com/typesense/typesense-dart/issues/143#issuecomment-2090680452, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACHOVS2MXAFVZ5NG762D6DLZAJGHTAVCNFSM6AAAAABHCN4AJWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJQGY4DANBVGI. You are receiving this because you were mentioned.Message ID: @.***>

happy-san commented 6 months ago

https://github.com/typesense/typesense-dart/issues/116#issuecomment-1113516045 This user also had the same issue and he said it worked fine with direct HTTP call https://pub.dev/packages/http#using Could you try if this works for you also? I can then take a closer look into the package itself.