typesense / firestore-typesense-search

Firebase Extension to automatically push Firestore documents to Typesense for full-text search with typo tolerance, faceting, and more
https://extensions.dev/extensions/typesense/firestore-typesense-search
Apache License 2.0
150 stars 27 forks source link

Host issues with DNS ip https - EAI_AGAIN and ECONNREFUSED #33

Closed idkq closed 2 years ago

idkq commented 2 years ago

Hi, I've been trying to setup this for a while now and I never get any errors but nothing happens when I update or add docs to the collection it was supposed to be indexing. How to troubleshoot the change in the document? What commands should I use?

The only log I can see is when running tail -f /var/log/typesense/typesense.log

I20220618 02:35:29.949776 28495 raft_server.h:60] Peer refresh succeeded!
I20220618 02:35:39.951146 28490 raft_server.cpp:531] Term: 5, last_index index: 18, committed_index: 18, known_applied_index: 18, applying_index: 0, queued_writes: 0, pending_queue_size: 0, local_sequence: 44

Cloud logs return 0 logs.

My setup:

Questions:

image

I am using this to test if a change in a doc creates any new document but It always return 0 documents.

curl -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
     -X GET \
    "https://EXAMPLE.com:8108/collections/service"
{"created_at":1655499258,"default_sorting_field":"","fields":[{"facet":false,"index":true,"infix":false,"locale":"","name":".*","optional":true,"sort":false,"type":"auto"}],"name":"service","num_documents":0,"symbols_to_index":[],"token_separators":[]}%       
idkq commented 2 years ago

Actually I was having issues navigating the Cloud Function log.

I'm getting two errors

If host is https://EXAMPLE.com I get this error:

EAI_AGAIN getaddrinfo EAI_AGAIN https

See https://github.com/typesense/firestore-typesense-search/issues/16

If I omit https from host and add port (EXAMPLE.com:8108) I have:

ECONNREFUSED connect ECONNREFUSED x.x.x.x:443"

jasonbosco commented 2 years ago

The extension only works on port 443, since Firebase makes calls out over the public internet.

So you'd only need to specify EXAMPLE.com in the host name field, and run Typesense on port 443 with an SSL certificate.

idkq commented 2 years ago

Changing the port from 8108 to 443 worked for me. Many thanks @jasonbosco