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
159 stars 35 forks source link

Firebase extension host #7

Closed aaronkbutler closed 3 years ago

aaronkbutler commented 3 years ago

Description

I have setup the typesense extension in my Firebase project, but when trying to add a document, i get the following error:

Error detected in ext-firestore-typesense-search-indexToTypesenseOnFirestoreWrite {"@type":"type.googleapis.com/google.devtools.clouderrorreporting.v1beta1.Insight","errorGroup":"CNTlnprCi-zYJw","exceptionInfo":{"type":"Error","message":"timeout of 10000ms exceeded"},"errorEvent":{"eventTime":"2021-07-08T20:47:32.503Z","message":"Error: timeout of 10000ms exceeded\n at createError (/workspace/node_modules/axios/lib/core/createError.js:16:15)\n at RedirectableRequest.handleRequestTimeout (/workspace/node_modules/axios/lib/adapters/http.js:280:16)\n at RedirectableRequest.emit (events.js:376:20)\n at RedirectableRequest.emit (domain.js:532:15)\n at Timeout._onTimeout (/workspace/node_modules/follow-redirects/index.js:166:12)\n at listOnTimeout (internal/timers.js:555:17)\n at processTimers (internal/timers.js:498:7)","serviceContext":{"resourceType":"cloud_function","service":"ext-firestore-typesense-search-indexToTypesenseOnFirestoreWrite"}}}

I am hosting the server on my local machine for the time being, so perhaps the problem is stemming from the host name that I used when setting up the extension. I set up port forwarding in order to get a global IP address, and used that address XX.XX.XX:8108 as the host name. Sending curl requests via the terminal to that host name works, however.

jasonbosco commented 3 years ago

Hi @aaronkbutler, the extension only supports HTTPS over 443. More context here: https://github.com/typesense/firestore-typesense-search/issues/4#issuecomment-870957252

jasonbosco commented 3 years ago

Btw, one quick way to expose your local Typesense server via HTTPS would be to use something like ngrok

$ ngrok http 8108

ngrok by @inconshreveable                                                           (Ctrl+C to quit)

Session Status                online
Account                       Jason Bosco (Plan: Free)
Version                       2.3.40
Region                        United States (us)
Web Interface                 http://127.0.0.1:4040
Forwarding                    http://c8cce57ee176.ngrok.io -> http://localhost:8108
Forwarding                    https://c8cce57ee176.ngrok.io -> http://localhost:8108

Connections                   ttl     opn     rt1     rt5     p50     p90
                              0       0       0.00    0.00    0.00    0.00

And then use c8cce57ee176.ngrok.io as the hostname in the extension.

aaronkbutler commented 3 years ago

Thanks very much!