Skip to content

A namespace must be supplied with no further debugging explanation on emulator setup #8390

Closed

Description

@tharropoulos

[REQUIRED] Environment info

firebase-tools: 13.29.0

Platform: Linux 6.12.17-1-lts

[REQUIRED] Test case

https://github.com/tharropoulos/firebase-reprod

[REQUIRED] Steps to reproduce

  • Create a project with emulators for functions, extensions and firestore
  • Add the Typesense Firestore adapter with the v2 API
  • Try to start the emulators
  • Get the a namespace must be supplied error, with no further explanation

[REQUIRED] Expected behavior

Get a better debug log to identify the issue in the extension

[REQUIRED] Actual behavior

Get this debug log:

[2025-03-31T09:05:39.533Z] [Extensions] Connecting Extensions emulator, this is a noop.
i  functions: Watching "/home/fanis/.cache/firebase/extensions/typesense/[email protected]/functions" for Cloud Functions... {"metadata":{"emulator":{"name":"functions"},"message":"Watching \"/home/fanis/.cache/firebase/extensions/typesense/[email protected]/functions\" for Cloud Functions..."}}
✔  functions: Loaded functions definitions from source: indexOnWrite, backfill. {"metadata":{"emulator":{"name":"functions"},"message":"Loaded functions definitions from source: indexOnWrite, backfill."}}
[2025-03-31T09:05:39.535Z] Found a v2 firestore trigger.
[2025-03-31T09:05:39.537Z] Could not find VSCode notification endpoint: FetchError: request to http://localhost:40001/vscode/notify failed, reason: connect ECONNREFUSED ::1:40001. If you are not running the Firebase Data Connect VSCode extension, this is expected and not an issue.
i  emulators: Shutting down emulators. {"metadata":{"emulator":{"name":"hub"},"message":"Shutting down emulators."}}
i  ui: Stopping Emulator UI {"metadata":{"emulator":{"name":"ui"},"message":"Stopping Emulator UI"}}
i  extensions: Stopping Extensions Emulator {"metadata":{"emulator":{"name":"extensions"},"message":"Stopping Extensions Emulator"}}
[2025-03-31T09:05:39.538Z] [Extensions] Stopping Extensions emulator, this is a noop.
i  functions: Stopping Functions Emulator {"metadata":{"emulator":{"name":"functions"},"message":"Stopping Functions Emulator"}}
i  firestore: Stopping Firestore Emulator {"metadata":{"emulator":{"name":"firestore"},"message":"Stopping Firestore Emulator"}}
[2025-03-31T09:05:39.540Z] *** shutting down gRPC server since JVM is shutting down
 {"metadata":{"emulator":{"name":"firestore"},"message":"*** shutting down gRPC server since JVM is shutting down\n"}}
[2025-03-31T09:05:39.556Z] *** server shut down
 {"metadata":{"emulator":{"name":"firestore"},"message":"*** server shut down\n"}}
i  eventarc: Stopping Eventarc Emulator {"metadata":{"emulator":{"name":"eventarc"},"message":"Stopping Eventarc Emulator"}}
i  tasks: Stopping Cloud Tasks Emulator {"metadata":{"emulator":{"name":"tasks"},"message":"Stopping Cloud Tasks Emulator"}}
i  hub: Stopping emulator hub {"metadata":{"emulator":{"name":"hub"},"message":"Stopping emulator hub"}}
i  logging: Stopping Logging Emulator {"metadata":{"emulator":{"name":"logging"},"message":"Stopping Logging Emulator"}}
[2025-03-31T09:05:39.896Z] Could not find VSCode notification endpoint: FetchError: request to http://localhost:40001/vscode/notify failed, reason: connect ECONNREFUSED ::1:40001. If you are not running the Firebase Data Connect VSCode extension, this is expected and not an issue.

Error: A namespace must be supplied.

Activity

  1. tharropoulos commented on Mar 31, 2025

    @tharropoulos
    Author

    The extension.yaml of the Typesense extension:

    name: firestore-typesense-search
    version: 2.0.1
    specVersion: v1beta # Firebase Extensions specification version (do not edit)
    
    displayName: Search Firestore with Typesense
    description: Indexes data from Firestore into Typesense for full-text search
    
    license: Apache-2.0 # The license you want for the extension
    
    author:
      authorName: Typesense
      url: https://typesense.org
    
    sourceUrl: https://github.com/typesense/firebase-typesense-search-extension/tree/master
    releaseNotesUrl: https://github.com/typesense/firestore-typesense-search/releases
    
    billingRequired: true
    
    resources:
      - name: indexOnWrite
        description: A function that indexes data into Typesense when it's triggered by Firestore changes
        type: firebaseextensions.v1beta.v2function
        properties:
          location: ${LOCATION}
          sourceDirectory: functions
          buildConfig:
            runtime: nodejs22
          serviceConfig:
            timeoutSeconds: 540
          eventTrigger:
            eventType: google.cloud.firestore.document.v1.written
            triggerRegion: ${FIRESTORE_DATABASE_REGION}
            eventFilters:
              - attribute: database
                value: ${DATABASE}
              - attribute: document
                value: ${FIRESTORE_COLLECTION_PATH}/{documentID}
                operator: match-path-pattern
    
      - name: backfill
        description: >-
          A function that backfills data from a Firestore collection into Typesense,
          triggered when a Firestore document with the path `typesense_sync/backfill` has the contents of `trigger: true`.
        type: firebaseextensions.v1beta.v2function
        properties:
          location: ${LOCATION}
          buildConfig:
            runtime: nodejs22
          sourceDirectory: functions
          serviceConfig:
            timeoutSeconds: 540
            availableMemory: 2048M
          eventTrigger:
            eventType: google.cloud.firestore.document.v1.written
            triggerRegion: ${FIRESTORE_DATABASE_REGION}
            eventFilters:
              - attribute: database
                value: ${DATABASE}
              - attribute: document
                value: typesense_sync/backfill
                operator: match-path-pattern
    
    roles:
      - role: datastore.user
        reason: Required to backfill data from your Firestore collection into Typesense
    
    externalServices:
      - name: Typesense Cloud
        PricingUri: https://cloud.typesense.org/pricing
      - name: Typesense Self Hosted (Free)
        PricingUri: https://typesense.org/downloads
    
    params:
      - param: LOCATION
        label: Cloud Functions location
        description: >-
          Where do you want to deploy the functions created for this extension?
          For optimal performance, select a location close to your Firestore database region.
        type: select
        options:
          # North America
          - label: us-central1 (Iowa)
            value: us-central1
          - label: us-east1 (South Carolina)
            value: us-east1
          - label: us-east4 (Northern Virginia)
            value: us-east4
          - label: us-east5 (Columbus)
            value: us-east5
          - label: us-south1 (Dallas)
            value: us-south1
          - label: us-west1 (Oregon)
            value: us-west1
          - label: us-west2 (Los Angeles)
            value: us-west2
          - label: us-west3 (Salt Lake City)
            value: us-west3
          - label: us-west4 (Las Vegas)
            value: us-west4
          - label: northamerica-northeast1 (Montreal)
            value: northamerica-northeast1
          - label: northamerica-northeast2 (Toronto)
            value: northamerica-northeast2
          
          # South America
          - label: southamerica-east1 (Sao Paulo)
            value: southamerica-east1
          - label: southamerica-west1 (Santiago)
            value: southamerica-west1
          
          # Europe
          - label: europe-north1 (Finland)
            value: europe-north1
          - label: europe-west1 (Belgium)
            value: europe-west1
          - label: europe-west2 (London)
            value: europe-west2
          - label: europe-west3 (Frankfurt)
            value: europe-west3
          - label: europe-west4 (Netherlands)
            value: europe-west4
          - label: europe-west6 (Zurich)
            value: europe-west6
          - label: europe-west8 (Milan)
            value: europe-west8
          - label: europe-west9 (Paris)
            value: europe-west9
          - label: europe-west10 (Berlin)
            value: europe-west10
          - label: europe-west12 (Turin)
            value: europe-west12
          - label: europe-central2 (Warsaw)
            value: europe-central2
          - label: europe-southwest1 (Madrid)
            value: europe-southwest1
          
          # Middle East
          - label: me-central1 (Doha)
            value: me-central1
          - label: me-central2 (Dammam)
            value: me-central2
          - label: me-west1 (Tel Aviv)
            value: me-west1
          
          # Asia
          - label: asia-east1 (Taiwan)
            value: asia-east1
          - label: asia-east2 (Hong Kong)
            value: asia-east2
          - label: asia-northeast1 (Tokyo)
            value: asia-northeast1
          - label: asia-northeast2 (Osaka)
            value: asia-northeast2
          - label: asia-northeast3 (Seoul)
            value: asia-northeast3
          - label: asia-south1 (Mumbai)
            value: asia-south1
          - label: asia-south2 (Delhi)
            value: asia-south2
          - label: asia-southeast1 (Singapore)
            value: asia-southeast1
          - label: asia-southeast2 (Jakarta)
            value: asia-southeast2
          
          # Australia
          - label: australia-southeast1 (Sydney)
            value: australia-southeast1
          - label: australia-southeast2 (Melbourne)
            value: australia-southeast2
        default: us-central1
        required: true
        immutable: true
    
      - param: FIRESTORE_DATABASE_REGION
        label: Firestore Database region
        description: >-
          The region where your Firestore database is located.
        type: select
        options:
          # Multi-region locations
          - label: nam5 (US multi-region)
            value: nam5
          - label: eur3 (Europe multi-region)
            value: eur3
          # North America
          - label: us-central1 (Iowa)
            value: us-central1
          - label: us-west1 (Oregon)
            value: us-west1
          - label: us-west2 (Los Angeles)
            value: us-west2
          - label: us-west3 (Salt Lake City)
            value: us-west3
          - label: us-west4 (Las Vegas)
            value: us-west4
          - label: us-east1 (South Carolina)
            value: us-east1
          - label: us-east4 (Northern Virginia)
            value: us-east4
          - label: us-east5 (Columbus)
            value: us-east5
          - label: us-south1 (Dallas)
            value: us-south1
          - label: northamerica-northeast1 (Montreal)
            value: northamerica-northeast1
          - label: northamerica-northeast2 (Toronto)
            value: northamerica-northeast2
          - label: northamerica-south1 (Queretaro)
            value: northamerica-south1
          # South America
          - label: southamerica-east1 (São Paulo)
            value: southamerica-east1
          - label: southamerica-west1 (Santiago)
            value: southamerica-west1
          # Europe
          - label: europe-west1 (Belgium)
            value: europe-west1
          - label: europe-west2 (London)
            value: europe-west2
          - label: europe-west3 (Frankfurt)
            value: europe-west3
          - label: europe-west4 (Netherlands)
            value: europe-west4
          - label: europe-west6 (Zürich)
            value: europe-west6
          - label: europe-west8 (Milan)
            value: europe-west8
          - label: europe-west9 (Paris)
            value: europe-west9
          - label: europe-west10 (Berlin)
            value: europe-west10
          - label: europe-west12 (Turin)
            value: europe-west12
          - label: europe-central2 (Warsaw)
            value: europe-central2
          - label: europe-north1 (Finland)
            value: europe-north1
          - label: europe-north2 (Stockholm)
            value: europe-north2
          - label: europe-southwest1 (Madrid)
            value: europe-southwest1
          # Middle East
          - label: me-central1 (Doha)
            value: me-central1
          - label: me-central2 (Dammam)
            value: me-central2
          - label: me-west1 (Tel Aviv)
            value: me-west1
          # Asia
          - label: asia-east1 (Taiwan)
            value: asia-east1
          - label: asia-east2 (Hong Kong)
            value: asia-east2
          - label: asia-northeast1 (Tokyo)
            value: asia-northeast1
          - label: asia-northeast2 (Osaka)
            value: asia-northeast2
          - label: asia-northeast3 (Seoul)
            value: asia-northeast3
          - label: asia-south1 (Mumbai)
            value: asia-south1
          - label: asia-south2 (Delhi)
            value: asia-south2
          - label: asia-southeast1 (Singapore)
            value: asia-southeast1
          - label: asia-southeast2 (Jakarta)
            value: asia-southeast2
          # Australia
          - label: australia-southeast1 (Sydney)
            value: australia-southeast1
          - label: australia-southeast2 (Melbourne)
            value: australia-southeast2
          # Africa
          - label: africa-south1 (Johannesburg)
            value: africa-south1
        default: nam5
        required: true
        immutable: true
    
      - param: DATABASE
        label: Firestore Database
        description: >-
          The Firestore database to use. Use "(default)" for the default database.
        example: "(default)"
        default: "(default)"
        required: false
    
      - param: FIRESTORE_COLLECTION_PATH
        label: Firestore Collection Path
        description: >-
          The Firestore collection that needs to be indexed into Typesense.
        example: path/to/firestore_collection
        validationRegex: "^[^/]+(/[^/]+/[^/]+)*$"
        validationErrorMessage: Firestore collection paths must be an odd number of segments separated by slashes, e.g. "path/to/firestore_collection".
        default: path/to/firestore_collection
        required: true
        immutable: true
      - param: FIRESTORE_COLLECTION_FIELDS
        label: Firestore Collection Fields
        description: >-
          A comma separated list of fields that need to be indexed from each Firestore document. Leave blank to index all fields.
        example: field1,field2,field3
        default: ""
        required: false
      - param: TYPESENSE_HOSTS
        label: Typesense Hosts
        description: >-
          A comma-separated list of Typesense Hosts.
          For single node clusters, a single hostname is sufficient. For multi-node Highly Available or SDN Clusters,
          please be sure to mention all hostnames.
        example: xyz.a1.typesense.net,xyz-1.a1.typesense.net,xyz-2.a1.typesense.net,xyz-3.a1.typesense.net
        required: true
      - param: TYPESENSE_API_KEY
        label: Typesense API Key
        type: secret
        description: >-
          An Typesense API key with admin permissions.
          Click on "Generate API Key" in cluster dashboard in Typesense Cloud
        example: ""
        required: true
      - param: TYPESENSE_COLLECTION_NAME
        label: Typesense Collection Name
        description: >-
          Typesense collection name to index data into. This collection needs to exist before this extension is installed. Please create it via the Typesense Cloud dashboard or API.
        default: companies
        required: true
      - param: FLATTEN_NESTED_DOCUMENTS
        label: Flatten Nested Documents
        description: >-
          Should nested documents in Firestore be flattened by this extension before they are indexed in Typesense? 
          Set to "Yes" for Typesense versions 0.23.1 and earlier. Set to "No" for Typesense versions 0.24.0 and later.
        type: select
        options:
          - label: No
            value: false
          - label: Yes
            value: true
        default: false
        required: false
      - param: LOG_TYPESENSE_INSERTS
        label: Log Typesense Inserts for Debugging
        description: >-
          Should data inserted into Typesense be logged in Cloud Logging? This can be useful for debugging, but should not be enabled in production.
        type: select
        options:
          - label: No
            value: false
          - label: Yes
            value: true
        default: false
        required: false
  2. joehan commented on Apr 1, 2025

    @joehan
    Member

    Hey @tharropoulos, sorry to hear that you're running into this error. I took a look at https://github.com/tharropoulos/firebase-reprod, and it looks like there is no extensions/firestore-typesense-search.env file there. Could you upload that if you have it (remove any sensitive params first)? It will help us debug this issue.

    Regardless of the root cause, this error message is very unclear and definitely something that we should at the very least clarify

  3. tharropoulos commented on Apr 1, 2025

    @tharropoulos
    Author

    @joehan Thanks for looking into it. I've updated the gitignore to track the env files.

  4. joehan commented on Apr 1, 2025

    @joehan
    Member

    Thanks for the env files - I repro'd the issue locally. AFAICT, this is actually an error coming from the Typesense extension itself (see typesense/firestore-typesense-search#120). I'd recommend sharing this repro on that repo - that code is maintained by Typesense, so they should be able to help find/fix the root issue here.

  5. tharropoulos commented on Apr 1, 2025

    @tharropoulos
    Author

    Funnily enough, I'm part of the team and we're unable to find the root cause, that's why I opened this one up! Hahaha, are there any resources on what could be causing this namespace problem? It came up just after migrating to the V2 API

  6. joehan commented on Apr 1, 2025

    @joehan
    Member

    Ahhh, my bad! Definitely can try to help with that. It looks like the code is hitting this error:

    throw new FirebaseError("A namespace must be supplied.");
    which suggests that you need to add a namespace field to eventFilters on each Firestore triggered function in your resources.

    I don't immediately recall what that field looks like, but I'll try to find some docs that give an example and share them here.

    On a separate note, this error is super unhelpful and should at the very least include the name of the function having issues - that's on us to fix.

  7. tharropoulos commented on Apr 1, 2025

    @tharropoulos
    Author

    No need to find the docs, pointing me in the right direction was enough. Thanks for being so quick on this. Would you prefer I close this issue or leave it open for you to track progress on the error handling logic?

  8. joehan commented on Apr 1, 2025

    @joehan
    Member

    You can leave this open - as i'm digging more, it's pretty clear that the extensions emulator should have this value fall back to '(default)' if it is not provided (to match the behavior of firebase-functions). We can leave this open to track that work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions