Setup and Issues in Connecting Typesense Instance with Firebase Emulator
TLDR Michael.M seeks help on connecting a local Typesense instance to the Firebase local emulator. Jason suggests looking at emulator commands and creating a specific file. After various attempts and troubleshooting steps, Michael.M is able to establish the connection.
2
1
1
May 03, 2022 (18 months ago)
Michael.M
09:15 PMThis screenshot from the
firestore-typesense-search
docs is the only indication of using the emulator, but it doesn’t explain how Typesense will watch for changes to my emulator database (or is that even possible?). I am able to run the emulator, and I’m able to run a local copy of Typesense, but I’m not able to connect the two.I understand that I could probably just make a bunch of cloud functions that watch the data, but I was hoping to get those “sync” updates automatically so I can maintain the same code between dev and production.
Thanks in advance for any help!
Jason
09:26 PMJason
09:26 PMtest-params.env
using this file as an example: https://github.com/typesense/firestore-typesense-search/blob/master/test-params.local.envJason
09:27 PMMichael.M
09:46 PMMichael.M
10:08 PMnpm run emulator
within firestore-typesense-search
I receive an error that says: error: unknown option '--test-params'
I have created a test-params.env
and filled out the information. I’m unable to find any information about the --test-params option in the firebase CLI documentation. Here are the steps I took:1. clone
firestore-typesense-search
2. install npm packages
3. create test-params.env file and fill in information
4. run
npm run emulator
Running the typesenseServer script worked perfectly.
Jason
10:27 PMCould you install them and then try again?
Michael.M
10:30 PM1
Michael.M
10:31 PM1
May 04, 2022 (18 months ago)
Michael.M
08:35 PM--import=...
option in the emulator script (instead of the default “books” data). However, even though my data is populating properly in the extension’s firestore instance, I am not able to retrieve it from the Typesense data store. I am running this code in a separate file://typesense-test.js
const Typesense = require('typesense')
async function main() {
let client = new Typesense.Client({
'nodes': [{
'host': 'localhost',
'port': '8108',
'protocol': 'http'
}],
'apiKey': 'xyz',
'connectionTimeoutSeconds': 2
})
const test = await client.collections().retrieve()
console.log(test)
}
main()
And I receive
[]
in the console. I have set up the test-params.env
correctly, but still nothing is populated.I’m running both the extension emulator and the typesense server, and then I run the
node typesense-test.js
in a separate location.Jason
08:38 PMJason
08:39 PMMichael.M
08:39 PMMichael.M
09:23 PMMichael.M
09:24 PMJason
09:24 PMMichael.M
09:26 PM2
Typesense
Indexed 2779 threads (79% resolved)
Similar Threads
Setting up Typesense with Firestore Local Emulator
Isaac was struggling to run local emulator commands for Typesense with Firestore, Jason advised cloning the Github repository, running npm install and using Firebase-cli 10.x.
Syncing Firebase 'ref' Field with Typesense
Guillermo wanted to index a 'ref' field from firebase with typesense. Jason provided a solution which involved syncing `ref.path` as an addition to the existing fields. Guillermo confirmed the solution worked.
Troubleshooting 400 Error When Upgrading Typesense Firestore Extension
Orion experienced a `400` error after updating the Typesense Firestore extension, causing issues with cloud functions. They traced the issue back to a data type conflict in their Typesense collection schema after updating. With help from Jason and Kishore Nallan, they resolved the issue by recreating the collection.
Troubleshooting 409 Errors with Firestore to Typesense Cloud Function
Orion encounters 409 errors with `ext-firestore-typesense-search-indexToTypesenseOnFirestoreWrite` cloud function. Jason suggests possible solutions like querying Firestore on each change or tracking sync state in a collection. Both agreed on adding a config option. Orion proposed contributing a PR for the change.
Issues with Firebase Typesense Extension in Local Emulator
vajahath encountered issues with the Firebase Typesense Extension concerning host:port configuration and function timeout. Kishore Nallan clarified they should be separate, and Jason provided a guide to use the emulator with the extension.